From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | nikolay(at)samokhvalov(dot)com |
Cc: | PostgreSQL-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Sequences/defaults and pg_dump |
Date: | 2006-02-07 15:34:22 |
Message-ID: | 200602071534.k17FYMC04892@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Nikolay Samokhvalov wrote:
> On 2/7/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com> writes:
> > > testseq=# CREATE TABLE test(id SERIAL, data TEXT);
> > > NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for
> > > serial column "test.id"
> > > CREATE TABLE
> > > ***
> > > ALTER TABLE test ALTER COLUMN id SET DEFAULT nextval('test_id_seq') * 10;
> >
> > The correct solution to this is to forbid ALTER COLUMN SET DEFAULT on
> > a serial column, but we haven't gotten around to enforcing that yet.
> That's wrong!
> Forget about SERIAL. I have INTEGER column with some expression as
> DEFAULT in it. I use sequence in that expression and want this to be
> dumped correctly.
> The bug doesn't concerns SERIALs, in concerns general usage of sequences.
Uh, I can't reproduce the failure:
test=> CREATE SEQUENCE xx;
CREATE SEQUENCE
test=> CREATE TABLE test5(id integer DEFAULT nextval('xx'), data TEXT);
CREATE TABLE
test=> ALTER TABLE test5 ALTER COLUMN id SET DEFAULT nextval('test_id_seq') * 10;
ALTER TABLE
pg_dump has:
CREATE TABLE test2 (
id integer DEFAULT (nextval('test_id_seq'::regclass) * 10),
data text
);
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-02-07 15:36:00 | Re: Sequences/defaults and pg_dump |
Previous Message | Ludwig Isaac Lim | 2006-02-07 15:32:56 | Re: Clarification Regarding Vacuum and template1 |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-02-07 15:36:00 | Re: Sequences/defaults and pg_dump |
Previous Message | lrotger | 2006-02-07 15:33:55 | Re: Actual expression of a constraint |