From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Andreas Tille <tillea(at)rki(dot)de>, PostgreSQL SQL <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Explicite typecasting of functions |
Date: | 2002-08-15 08:43:53 |
Message-ID: | 200208150943.54761.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thursday 15 Aug 2002 8:13 am, Andreas Tille wrote:
> On Wed, 14 Aug 2002, Tom Lane wrote:
> > CREATE TABLE without mentioning the default
> > CREATE FUNCTION
> > ALTER TABLE ... SET DEFAULT
> >
> > Note however that pg_dump is not bright enough to deduce that you did
> > this. It will dump the table definition first, with the DEFAULT clause,
> > and so you'll have to do manual surgery on the dump file if you ever
> > need to reload.
>
> Hmmm, the original problem I wanted to solve using this function is that
> pg_dump is not bright enough to store sequences.
Eh? If you run a pg_dump on your database you should get something like:
CREATE SEQUENCE "bar_a_seq" start 1 increment 1 maxvalue 9223372036854775807
minvalue 1 cache 1;
CREATE TABLE "bar" (
"a" integer DEFAULT nextval('"bar_a_seq"'::text) NOT NULL,
"b" integer
);
... data then follows...
-- Name: bar_a_seq Type: SEQUENCE SET Owner: richardh
SELECT setval ('"bar_a_seq"', 3, true);
It's that last bit that sets the value of the sequence. Now AFAIK pg_dump's
been like that pretty much forever.
Note - if you only pg_dump the table, you won't get the sequence, you need to
dump the whole DB and grep away the bits you don't want.
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Bhuvan A | 2002-08-16 07:37:31 | Casting integer to boolean |
Previous Message | Andreas Tille | 2002-08-15 07:13:00 | Re: Explicite typecasting of functions |