Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-08 Thread Christopher Kings-Lynne
Not that I can see. You still have to get the sequence object from someplace, and having it be a distinct datatype is zero help for finding a column-specific sequence. What about allowing sequence qualifiers in the SERIAL definition? Chris ---(end of broadcast)-

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-03 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > Wouldn't a lot of this be solved (I know I am over simplyfing) by making > serial a real type? Not that I can see. You still have to get the sequence object from someplace, and having it be a distinct datatype is zero help for finding a column-speci

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-03 Thread Joshua D. Drake
Tom Lane wrote: Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: pg_dump will just emit "create table t1 (f1 serial)" with no hint that the sequence ought to be set to CYCLE mode. I'm not sure about an appropriate fix offhand --- we can't very well use ALTER SEQUENCE in just this way in the dum

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-03 Thread Tom Lane
Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: >> pg_dump will just emit "create table t1 (f1 serial)" with no hint that >> the sequence ought to be set to CYCLE mode. I'm not sure about an >> appropriate fix offhand --- we can't very well use ALTER SEQUENCE in >> just this way in the dump, b

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-03 Thread Dawid Kuroczko
On Wed, 2 Feb 2005 19:04:04 -0300, Alvaro Herrera <[EMAIL PROTECTED]> wrote: > > It is not pilot error if PostgreSQL allows it. There is > > nothing "illegal" about the above commands in their execution. > > The pg_dump application should recognize that the object has > > changed and react accordin

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-03 Thread Christopher Kings-Lynne
pg_dump will just emit "create table t1 (f1 serial)" with no hint that the sequence ought to be set to CYCLE mode. I'm not sure about an appropriate fix offhand --- we can't very well use ALTER SEQUENCE in just this way in the dump, because of the risk of the sequence name being possibly different

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Joshua D. Drake
3. When the default is changed, the dependency is updated to reflect the new sequence. The old sequence is left intact as an independent object. What exactly is the use-case of that (or any other manipulation of a serial column's default)? There is no point that I can see in just rolling one

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > Alvaro Herrera wrote: >> ISTM this is a bug, but it's not clear to me what is the solution. >> I can think of two: >> >> 1. Changing the default is forbidden >> 2. When the default is changed, the dependency on the sequence is >> dropped, and the seq

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Alvaro Herrera
On Wed, Feb 02, 2005 at 03:49:59PM -0800, Joshua D. Drake wrote: > Alvaro Herrera wrote: > > >On Wed, Feb 02, 2005 at 01:54:48PM -0800, Joshua D. Drake wrote: > > > >>It is not pilot error if PostgreSQL allows it. There is > >>nothing "illegal" about the above commands in their execution. > >>The

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Joshua D. Drake
Alvaro Herrera wrote: On Wed, Feb 02, 2005 at 01:54:48PM -0800, Joshua D. Drake wrote: It is not pilot error if PostgreSQL allows it. There is nothing "illegal" about the above commands in their execution. The pg_dump application should recognize that the object has changed and react accordingly

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Alvaro Herrera
On Wed, Feb 02, 2005 at 01:54:48PM -0800, Joshua D. Drake wrote: > It is not pilot error if PostgreSQL allows it. There is > nothing "illegal" about the above commands in their execution. > The pg_dump application should recognize that the object has > changed and react accordingly. ISTM this is

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Joshua D. Drake
create table foo (foo serial not null, bar text); create sequence foo_seq; alter table foo alter column foo set default nextval('foo_seq'); This is flat out pilot error: you do not get to mess with the default expression of a SERIAL column, because it's part of the internal implementation of

Re: [HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Tom Lane
"Joshua D. Drake" <[EMAIL PROTECTED]> writes: > However if you do the following: > create table foo (foo serial not null, bar text); > create sequence foo_seq; > alter table foo alter column foo set default nextval('foo_seq'); This is flat out pilot error: you do not get to mess with the default

[HACKERS] pg_dump bug in 7.3.9 with sequences

2005-02-02 Thread Joshua D. Drake
Hello, Ran into this little gem with a customer today: This works: create table foo (foo int not null, bar text); create sequence foo_seq; alter table foo alter column foo set default nextval('foo_seq'); pg_dump will correctly dump the table: CREATE TABLE foo ( foo integer DEFAULT nextval('foo_s