From: | "Eric Ridge" <ebr(at)tcdi(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | pg_dump and DEFAULT column values |
Date: | 2001-11-06 20:56:09 |
Message-ID: | D3ADE25911614840BC69C72E3171E4ED0FBDFF@tcdiexch.tcdi.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a function and a table:
create table foo (
f1 integer default foo_func();
);
create function foo_func returns integer
as 'select max(f1)+1 from foo'
language 'sql';
when I use pg_dump, and then psql (\i <dumpfile>) to dump/reload
everything, table foo can't be created because it uses foo_func which
can't be created because it uses a table (foo) which doesn't exist.
So I always have to hand-edit the dump file:
create table foo (
f1 integer;
);
create function foo_func returns integer
as 'select max(f1) from foo'
language 'sql';
alter table foo alter column f1 set default foo_func();
Is there a way for pg_dump to do this automagically? or should I define
the table and function differently? Should the default value be
replaced with an on insert trigger?
eric
From | Date | Subject | |
---|---|---|---|
Next Message | Keary Suska | 2001-11-06 21:01:14 | Re: Use of Serial Datatype and Sequence Issue |
Previous Message | Jeff Davis | 2001-11-06 20:51:07 | Re: functions vs embedded SQL |