Re: references again

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "D(dot)C(dot)" <coughlandesmond(at)yahoo(dot)fr>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: references again
Date: 2005-05-22 08:31:54
Message-ID: FC6B2F15-66C9-498C-A6A2-691A4CAC7A6D@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ramon Orticio 2005-05-23 01:37:27 postgres file
Previous Message D.C. 2005-05-22 07:53:05 references again