Search Postgresql Archives

Re: Setting Sequence Values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Title: RE: Setting Sequence Values

Joshua Drake spake thusly:
>
> On Fri, 21 Dec 2007 23:57:21 -0000
> Martin <martin@xxxxxxxxxxxxxx> wrote:
>
> > After porting tables and data from FrontBase I now find that I
> > need to update all the values for the sequences that were created
> > to reflect the data in the tables. Is there an easy way to do
> > this?
>
> Take a look at setval.
>
> postgres=# select setval('foo_id_seq',(select max(id) from foo));
>  setval
> - --------
>     100
> (1 row)
<...>

I think the OP needs a way to do _all_ of the sequences, which can be a little dauning if you have lots of tables. I'm sure there's a way but I haven't the time to puzzle it out -- off to SF for a(n) (im)moderate celebration. I might hack at this later tonight if I am capable.

Cheers!

Greg Williamson
Senior DBA
GlobeXplorer LLC, a DigitalGlobe company

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information and must be protected in accordance with those provisions. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

(My corporate masters made me say this.)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux