update table sequence

From: e(dot)ellenkamp(at)copernicus-it(dot)nl (Egbert Ellenkamp)
To: pgsql-sql(at)postgresql(dot)org
Subject: update table sequence
Date: 2001-03-16 12:15:28
Message-ID: 3ab203b3.242887724@newzilla.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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);

I read the documentation but could not find anything relevant.

Thanks in advance,

Egbert.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-03-16 16:40:22 Re: List Concatination
Previous Message Richard Huxton 2001-03-16 09:37:28 Re: Re: [SQL] Contribute to the PL/pgSQL CookBook !!