Re: Setting Sequence Values

Поиск
Список
Период
Сортировка
От Gregory Williamson
Тема Re: Setting Sequence Values
Дата
Msg-id 8B319E5A30FF4A48BE7EEAAF609DB233015E3125@COMAIL01.digitalglobe.com
обсуждение исходный текст
Ответ на Setting Sequence Values  (Martin <martin@cornhobble.com>)
Ответы Re: Setting Sequence Values  ("Joshua D. Drake" <jd@commandprompt.com>)
Список pgsql-general

Joshua Drake spake thusly:
>
> On Fri, 21 Dec 2007 23:57:21 -0000
> Martin <martin@cornhobble.com> 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.)

В списке pgsql-general по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Setting Sequence Values
Следующее
От: Martin
Дата:
Сообщение: Re: Setting Sequence Values