RE: Referential Integrity Problems - Mailing list pgsql-general
From | JohnC@firstlight.com |
---|---|
Subject | RE: Referential Integrity Problems |
Date | |
Msg-id | OFE982F06C.BC775A3A-ON852568CB.0056B4BD@firstlight.com Whole thread Raw |
In response to | Referential Integrity Problems (JohnC@firstlight.com) |
List | pgsql-general |
So then, I realize this may be a stupid question, is there no other way, aside from upgrading, to force referential integrity constraints to trigger automatically? And thanks for the quick response! John Clayton Knowledge Manager Site Builder First Light Communications 55 John St. 8th Floor New York, NY 10038 (212) 766-2380 x222 "Hentosh" <hentosh@io.c To: <JohnC@firstlight.com> om> cc: Subject: RE: [GENERAL] Referential Integrity Problems 04/24/00 11:35 AM 6.5.3 allows the syntax for foreign key support ... but doesn't do any contraint checking. if you need more support for foreign keys... use verion 7.0 I believe it is still beta... but reports are that it runs very stably now. I am new myselft. I am also looking at Interbase. www.interbase.com. Maybe this might be a better solution... I have not decided yet. - Robert -----Original Message----- From: pgsql-general-owner@hub.org [mailto:pgsql-general-owner@hub.org]On Behalf Of JohnC@firstlight.com Sent: Monday, April 24, 2000 10:13 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Referential Integrity Problems I'm rather new to Postgresql, but hope someone here can help me out. Even though I am specifying foreign and primary keys in my tables as I create them, the foreign key options, such as CASCADE and NO ACTION, don't seem to be working. I am allowed to change primary keys with no effect on the foreign keys and with no error messages generated. I am using PHP3 and postgresql 6.5.3 on Linux. I have tried using Bruce Momijian's example code verbatim, and still didn't seem to have any kind of foreign key constraints operating. Is this a result of some kind of installation/configuration problem? Below are sections of the PHP Code I am using to try Bruce's examples, though I don't run this all at once ( I ran it exactly in the order in which Bruce gave it): $connection = pg_connect("dbname=intranet user=intranet port=5432"); pg_exec($connection, "CREATE TABLE primarytest (col INTEGER PRIMARY KEY)"); pg_exec($connection, "CREATE TABLE foreigntest (col2 INTEGER REFERENCES primarytest ON UPDATE CASCADE ON DELETE NO ACTION)"); pg_exec($connection, "INSERT INTO primarytest VALUES(1)"); pg_exec($connection, "INSERT INTO foreigntest VALUES(1)"); $update = pg_exec($connection, "UPDATE primarytest SET col=2"); pg_exec($connection, "DELETE FROM primarytest"); $result = pg_exec($connection, "SELECT * FROM foreigntest"); print("<table border=1 cellpadding=2>\n"); for($i = 0; $i < pg_numrows($result); $i++) { $thisrow = pg_fetch_row($result,$i); print ("<tr><td>$i</td><td>$thisrow[0]</td><td>$thisrow[1]</td></tr>\n"); } print("</table>\n"); pg_freeresult($result); Your help is greatly appreciated. John Clayton Knowledge Manager Site Builder First Light Communications 55 John St. 8th Floor New York, NY 10038 (212) 766-2380 x222
pgsql-general by date: