At 22:05 3/08/00 -0300, Paulo Roberto Siqueira wrote:
>
>Why doesn't pg_dump give me foreign keys constraints? It happens to all the
>tables with foreign keys.
pg_dump does not restore the database by executing the same set of commands
as you used to create the database. Foreign key constraints are implemented
using a special kind of trigger (CONSTRAINT TRIGGER). If you look through
the pg_dump output, you will find a number of 'CREATE CONSTRAINT TRIGGER'
statements which will reapply the foreign key constraints.
This is definitely not an ideal situation, and with time I hope that
pg_dump output will become as close to ISO SQL as possible. But in the
example you quoted I would expect pg_dump to dump a basic 'create table'
statement followed by several 'alter table add constraint...' statements,
not one complex table definition.
Hope this helps,
Philip Warner.
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/