Re: catching up an id sequence - Mailing list pgsql-novice

From Tom Lane
Subject Re: catching up an id sequence
Date
Msg-id 17333.1091138467@sss.pgh.pa.us
Whole thread Raw
In response to catching up an id sequence  (Austin Swinney <austin@interactivate.com>)
List pgsql-novice
Austin Swinney <austin@interactivate.com> writes:
> Hi most esteemed novices and experts.  It is an honor to post here!
> I imported a MySQL dump into PostgreSQL (7.4.3) and was wondering what
> a good way to catch up the ID sequence table to be current with the
> table I imported.

You want setval().  The usual approach is

    select setval('tab_col_seq', (select max(col) from tab) + 1);

            regards, tom lane

pgsql-novice by date:

Previous
From: Austin Swinney
Date:
Subject: catching up an id sequence
Next
From: Steve Tucknott
Date:
Subject: Significant spaces