Re: references again

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: references again
Дата
Msg-id FC6B2F15-66C9-498C-A6A2-691A4CAC7A6D@myrealbox.com
обсуждение исходный текст
Ответ на references again  (D.C. <coughlandesmond@yahoo.fr>)
Список 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 по дате отправления:

Предыдущее
От: D.C.
Дата:
Сообщение: references again
Следующее
От: Ramon Orticio
Дата:
Сообщение: postgres file