Philip Warner wrote:
At 09:59 30/06/00 +0200, Guillaume Perréal wrote:
>>>> And the question is: Is there a better way to do what I want (checking field values from different tables against data in one table) that allow pg_dumpall to works ?
<<<<
I'm not sure what to suggest, but a FOREIGN KEY constraint might help. You would need to do one of two things:
1. add fieldname to the definition of station, then use
FOREIGN KEY ("fieldname", "type") references "information" (fieldName, code),
Well, I don't think adding the same value to each row of "station" is the better solution. But it's a solution.
OR 2. create a view:
create view "station_fields" as select * from information where fieldname = 'station.type';
then use:
FOREIGN KEY ( "type") references "station_fields" ( code),
I tried : it doesn't work. It seems that view rows don't have OID, which are used in foreign key. (I deduce that from the error messages I've got when I tried).
You'd need to assess the permance issues associated with each choice - some DB systems don't do views very well, and I have absolutely no experience with big views under PG.
"information" won't be a big view : less than one hundred tuples.
FWIW, I have just finished writing a modified pg_dump which restores things in a variety of possibl orders, and works with the example you quoted.
I'm just waiting on volunteers to test it...
Why not? But I can't promise you to do full testing as I've got a lot of work these days.
Thanks.
--
Guillaume Perréal - Stagiaire MIAG
Cemagref (URH), Lyon, France
Tél: (+33) 4.72.20.87.64