New setval() call
I am inclinded to remove this open item:
New SQL function setval(seq,val,bool) for use in pg_dump (Philip)
The use of the 3rd parameter, 'iscalled', while used by pg_dump, is not
of general use, so we probably don't need to document it. Is this valid?
Info on the new param is:
---------------------------------------------------------------------------
IRC the point of the nextval() is to ensure that the internal state of
the sequence is correct. There's a bool "is_called" in the sequence
that means something like "I've been nextval()'d at least once", and the
only clean way to make that become set is to issue a nextval. You can
watch the behavior by doing "select * from sequenceobject" between
sequence commands --- it looks like the first nextval() simply sets
is_called without changing last_value, and then subsequent nextval()s
increment last_value. (This peculiar arrangement makes it possible
to have a starting value equal to MININT, should you want to do so.)
So pg_dump needs to make sure it restores the correct setting of both
fields.
This is pretty grotty because it looks like there's no way to clear
is_called again, short of dropping and recreating the sequence.
So unless you want to do that always, a data-only restore couldn't
guarantee to restore the state of a virgin sequence.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
At 12:23 10/02/01 -0500, Bruce Momjian wrote:
I am inclinded to remove this open item:
New SQL function setval(seq,val,bool) for use in pg_dump (Philip)
The use of the 3rd parameter, 'iscalled', while used by pg_dump, is not
of general use, so we probably don't need to document it. Is this valid?Info on the new param is:
Fine with me; I think your recollection is correct - but it would be worth
putting a description *somewhere*. Do we have an internals doc of any kind?
Something that describes interfaces etc that are not guaranteed to remain
static or supported?
----------------------------------------------------------------
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 |/
At 12:23 10/02/01 -0500, Bruce Momjian wrote:
I am inclinded to remove this open item:
New SQL function setval(seq,val,bool) for use in pg_dump (Philip)
The use of the 3rd parameter, 'iscalled', while used by pg_dump, is not
of general use, so we probably don't need to document it. Is this valid?Info on the new param is:
Fine with me; I think your recollection is correct - but it would be worth
putting a description *somewhere*. Do we have an internals doc of any kind?
Something that describes interfaces etc that are not guaranteed to remain
static or supported?
Can you give me a few lines to put in sequence.c? There isn't even
anything in there!
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
At 18:34 10/02/01 -0500, Bruce Momjian wrote:
Can you give me a few lines to put in sequence.c? There isn't even
anything in there!
I've now put comments on setval, setval_is_called and do_setval. 3 for the
price of one.
----------------------------------------------------------------
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 |/