From: | JohnC(at)firstlight(dot)com |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | RE: Referential Integrity Problems |
Date: | 2000-04-24 15:49:12 |
Message-ID: | OFE982F06C.BC775A3A-ON852568CB.0056B4BD@firstlight.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)io(dot)c To: <JohnC(at)firstlight(dot)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(at)hub(dot)org [mailto:pgsql-general-owner(at)hub(dot)org]On
Behalf Of JohnC(at)firstlight(dot)com
Sent: Monday, April 24, 2000 10:13 AM
To: pgsql-general(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Ed Loehr | 2000-04-24 15:58:30 | Re: Revisited: Transactions, insert unique. |
Previous Message | JohnC | 2000-04-24 15:13:18 | Referential Integrity Problems |