Re: update table sequence

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: Egbert Ellenkamp <e(dot)ellenkamp(at)copernicus-it(dot)nl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: update table sequence
Date: 2001-03-16 19:58:24
Message-ID: 20010316135824.C11713@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Mar 16, 2001 at 12:15:28PM +0000, Egbert Ellenkamp wrote:
> All,
>
> Is there a way I can set the sequence of a table equal to highest row
> ID?
> For example something like:
> select setval('mytable_myrowid_seq',select max(myrowid) from mytable);

So close!

select setval('mytable_myrowid_seq',max(myrowid)) from mytable;

Ross

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-03-16 20:09:50 Re: update table sequence
Previous Message Mourad EL HADJ MIMOUNE 2001-03-16 17:15:29 SQL3 support