Re: Multi-table CHECK constraint

Поиск
Список
Период
Сортировка
От Richard Broersma
Тема Re: Multi-table CHECK constraint
Дата
Msg-id 396486430812101617p27c2f5f0te25cbc6fe8a6c31@mail.gmail.com
обсуждение исходный текст
Ответ на Multi-table CHECK constraint  (Jason Long <mailing.list@supernovasoftware.com>)
Ответы Re: Multi-table CHECK constraint
Список pgsql-general
On Wed, Dec 10, 2008 at 3:58 PM, Jason Long
<mailing.list@supernovasoftware.com> wrote:

> I need to add some complex constraints at the DB.
> These will involve several tables.
> What is the best approach for this?

Well ANSI-SQL provides the CREATE ASSERTION for this purpose.
However, PostgreSQL doesn't support this feature.  It can be mimiced
by using the PostgreSQL CONSTRAINT TRIGGER extenstion.  IIRC, it works
very much like an ordinary trigger except that you must raise an error
when an DML attempt possibly violates your condition.

> Can someone point me to an example of doing something like this?

http://www.postgresql.org/docs/8.3/interactive/sql-createconstraint.html
http://www.postgresql.org/docs/8.3/interactive/triggers.html

I hope this helps.


--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

В списке pgsql-general по дате отправления:

Предыдущее
От: David Wall
Дата:
Сообщение: Re: Data Replication
Следующее
От: Jason Long
Дата:
Сообщение: Re: Multi-table CHECK constraint