Re: CHECK Constraint Deferrable

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: CHECK Constraint Deferrable
Дата
Msg-id CAKFQuwZf0We7p-7Df-Fyxrfv+cS=meF0DorEtuBWx5nhLZ+j9A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: CHECK Constraint Deferrable  (Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com>)
Ответы Re: CHECK Constraint Deferrable  (Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com>)
Список pgsql-hackers
On Friday, July 7, 2023, Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com> wrote:
I can think of one scenario, as below

1) any department should have an employee
2)any employee should be assigned to a department
so, the employee table has a FK to the department table, and another check constraint should be added to the department table to ensure there should be one/more employees in this department. 


That isn’t a valid/allowed check constraint - it contains a prohibited reference to another table.

David J.

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

Предыдущее
От: Himanshu Upadhyaya
Дата:
Сообщение: Re: CHECK Constraint Deferrable
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Unlogged relations and WAL-logging