Обсуждение: Why pg_dump doesn't dump the foriegn keys?

Поиск
Список
Период
Сортировка

Why pg_dump doesn't dump the foriegn keys?

От
Raymond Chui
Дата:
I do

pg_dump -u -s dbname > db_schema

I look at that db_schema file, I only see the primary keys but no
foreign keys.
I don't understand what is OID use for. Will -o option dump the foreign
keys for me?
Thank you!

--
Why we want to teach our babies to talk and walk,
then later we tell them "sit down!", "be quiet!" ?

Democracy is not a better way for a solution,
it is just another way to spread the blames.

--Raymond


Вложения

Re: Why pg_dump doesn't dump the foriegn keys?

От
"Gregory Wood"
Дата:
> pg_dump -u -s dbname > db_schema
>
> I look at that db_schema file, I only see the primary keys but no
> foreign keys.
> I don't understand what is OID use for. Will -o option dump the foreign
> keys for me?

I could be wrong, but it sounds like you haven't examined your entire dump
file. Check the end of the file, after all your COPYs and underneath your
index creations, you *should* see a bunch of "CREATE CONSTRAINT TRIGGER..."
etc. Those should be your foreign key checks, followed by any other triggers
and whatnot. Try importing your dump file into another db and testing it...
you should find that the foreign keys work fine.

Greg