BUG #2245: pg_dump doesn't dump expressions with sequence in DEFAULT setting for some column in table

Started by Nikolay Samokhvalovabout 20 years ago2 messagesbugs
Jump to latest
#1Nikolay Samokhvalov
samokhvalov@gmail.com

The following bug has been logged online:

Bug reference: 2245
Logged by: Nikolay Samokhvalov
Email address: samokhvalov@gmail.com
PostgreSQL version: 8.1.2
Operating system: Linux Fedora Core 4
Description: pg_dump doesn't dump expressions with sequence in
DEFAULT setting for some column in table
Details:

I use some expression as DEFAULT setting for some column of some table. For
example, nextval('myseq') * 10.
Then, I pg_dump my database and restore it. I see 'nextval('myseq')' (w/o
'*10').

(Surely, '*10' is just an example, I know, that I can increase the INCREMENT
parameter for the sequence.)

I suppose it's a bug.

More details:
http://archives.postgresql.org/pgsql-general/2006-02/msg00251.php

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Nikolay Samokhvalov (#1)
Re: BUG #2245: pg_dump doesn't dump expressions with sequence in DEFAULT setting for some column in table

"Nikolay Samokhvalov" <samokhvalov@gmail.com> writes:

I use some expression as DEFAULT setting for some column of some table. For
example, nextval('myseq') * 10.
Then, I pg_dump my database and restore it. I see 'nextval('myseq')' (w/o
'*10').

You mustn't fool with the default expression for a serial column. You
should have declared this as a plain integer column with a handmade
default expression.

regards, tom lane