Re: pg_dump and sequences - RFC - Mailing list pgsql-hackers

From Philip Warner
Subject Re: pg_dump and sequences - RFC
Date
Msg-id 3.0.5.32.20000929015224.041d3aa0@mail.rhyme.com.au
Whole thread Raw
In response to Re: pg_dump and sequences - RFC  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_dump and sequences - RFC
List pgsql-hackers
At 10:36 28/09/00 -0400, Tom Lane wrote:
>Philip Warner <pjw@rhyme.com.au> writes:
>> My inclinations is do do the following:
>
>> - Issue 'CREATE SEQUENCE...Initial Value 1...' in OID order
>> - Issue 'SELECT SETVAL...' at end of data load.
>
>Seems reasonable, except you should not necessarily use 1; that could
>be outside the defined range of the sequence object.  Use its min_value
>instead.

OK. Given the discussion of 'select nextval', do you know if 'select
setval' will set the is_called flag? If not should I:


Issue 'CREATE SEQUENCE...Initial Value <MINVAL>...' in OID order

if (is_called was set AND we've loaded any data) then
   Issue 'SELECT NEXTVAL...' at end of data load, and *before* setval.   Issue 'SELECT SETVAL...' at end of data load.

endif


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump and sequences - RFC
Next
From: Tom Lane
Date:
Subject: Re: pg_dump and sequences - RFC