Re: help with table constraint / check

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: help with table constraint / check
Дата
Msg-id 20030315162954.GA17488@wolff.to
обсуждение исходный текст
Ответ на help with table constraint / check  (cliff@cliffmeyers.com)
Список pgsql-sql
On Sat, Mar 15, 2003 at 07:38:20 -0800, cliff@cliffmeyers.com wrote:
> 
> What I want to do is set up a constraint / check so that when a record is added,
> it takes the parent_id being passed in the INSERT statement, looks at the record
> whose fs_id equals the parent_id, and makes sure that the fs_type for that record
> is 'dir' and not 'file'.
> 
> Can I do this with standard constraints or do I need to use some PL/pgSQL
> features? Anyone have a few hints? Thanks!

One way to do this is to add a column with the parent's file system
type (constrained to be 'dir') and then make the foreign key to the parent use
both the parent ID and the file system type. 


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

Предыдущее
От: cliff@cliffmeyers.com
Дата:
Сообщение: help with table constraint / check
Следующее
От: "Jordan S. Jones"
Дата:
Сообщение: Retrieving Definition for Composite Type