| От | Peter Eisentraut |
|---|---|
| Тема | Re: Foreign Unique Constraint |
| Дата | |
| Msg-id | 200703271758.42413.peter_e@gmx.net обсуждение исходный текст |
| Ответ на | Foreign Unique Constraint ("Jon Horsman" <horshaq@gmail.com>) |
| Список | pgsql-sql |
Jon Horsman wrote: > Basically table 1 and table 2 both have the concept of an extension > that must be unique but the rest of the info in the tables are > different. I need to ensure that if i add an entry to table 1 with > extension 1000 that it will fail if there is already an entry in > table2 with the same extension. Make a third table that contains all the extension and add two columns, one referencing table 1 and one referencing table 2, and then add a constraint that only one of the two can be not null. It's not very pretty, but you can use views to make the access simpler. -- Peter Eisentraut http://developer.postgresql.org/~petere/
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера