| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера