Re: references again - Mailing list pgsql-novice

From Michael Glaesemann
Subject Re: references again
Date
Msg-id FC6B2F15-66C9-498C-A6A2-691A4CAC7A6D@myrealbox.com
Whole thread Raw
In response to references again  (D.C. <coughlandesmond@yahoo.fr>)
List pgsql-novice
On May 22, 2005, at 4:53 PM, D.C. wrote:

> NOTICE:  CREATE TABLE will create implicit sequence
> "ventes_ventes_id_seq" for serial column "ventes.ventes_id"
> NOTICE:  CREATE TABLE will create implicit sequence
> "ventes_ventes_stock_id_seq" for serial column
> "ventes.ventes_stock_id"
> NOTICE:  adding missing FROM-clause entry for table "stock"
> ERROR:  only table "ventes" can be referenced in check constraint

As the error states, CHECK constraints currently only permit
comparisons within the same table. To compare values across tables,
such as you are looking to do, you need to use a trigger that will
raise an error if the conditions you desire are not met.

Check out the CREATE TRIGGER documentation in the SQL command
reference in the PostgreSQL docs. You're probably interested in
BEFORE INSERT and BEFORE UPDATE triggers.

<http://www.postgresql.org/docs/8.0/interactive/sql-createtrigger.html>

Hope this helps.

Michael Glaesemann
grzm myrealbox com

PS. Regarding your earlier question regarding your email address
showing up in your newreader, I don't think there's a whole lot that
can be done about that, though I wouldn't mind being proven wrong.
You can take some comfort in knowing that email addresses are
obscured in the www.postgresql.org mailing list archives.

pgsql-novice by date:

Previous
From: D.C.
Date:
Subject: references again
Next
From: Ramon Orticio
Date:
Subject: postgres file