Re: setting last_value of sequence

From: "Gregory S(dot) Williamson" <gsw(at)globexplorer(dot)com>
To: "John Harrold" <jmh17(at)pitt(dot)edu>, "pgsql general list" <pgsql-general(at)postgresql(dot)org>
Subject: Re: setting last_value of sequence
Date: 2003-09-03 21:40:15
Message-ID: 71E37EF6B7DCC1499CEA0316A2568328DC98A5@loki.globexplorer.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Perhaps:
SELECT SETVAL('resrc_serial', MAX(resource_id)) FROM ia_resources;
the sequence the column the table
This sets the sequence to the highest number after I have used "copy" to load a table; other values instead of MAX() could be used (e.g. 123456, etc.).

HTH,

Greg Williamson

-----Original Message-----
From: John Harrold [mailto:jmh17(at)pitt(dot)edu]
Sent: Tuesday, September 02, 2003 2:01 PM
To: pgsql general list
Subject: [GENERAL] setting last_value of sequence

i've run into the situation where i need to set the last_value of a
sequence. can someone tell me how this is done?

--
--------------------------------------------------------------------------
| /"\
john harrold | \ / ASCII ribbon campaign
jmh at member.fsf.org | X against HTML mail
the most useful idiot | / \
--------------------------------------------------------------------------
What difference does it make to the dead, the orphans, and the homeless,
whether the mad destruction is brought under the name of totalitarianism or
the holy name of liberty and democracy?
--Gandhi
--------------------------------------------------------------------------
gpg --keyserver keys.indymedia.org --recv-key F65A739E
--------------------------------------------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-09-03 21:50:22 Re: Index not being used ?
Previous Message Adam Kavan 2003-09-03 21:38:45 Re: pg_autovacuum