|
Запрет удаления в таблице
|
|||
---|---|---|---|
#18+
Каким можно настроить таблицу Код: plsql 1. 2. 3. 4.
так, чтобы она запрещала удалять модель автомобиля, если на него есть ссылка в таблице Код: plsql 1. 2. 3. 4. 5.
. ... |
|||
:
Нравится:
Не нравится:
|
|||
13.06.2021, 01:29 |
|
Запрет удаления в таблице
|
|||
---|---|---|---|
#18+
Максим Сысоев, Согласно документации https://www.postgresql.org/docs/13/ddl-constraints.html#DDL-CONSTRAINTS-FK оно у вас в таком виде и так уже есть. Т.е. специально делать ничего не надо. документацияRestricting and cascading deletes are the two mоst common options. RESTRICT prevents deletion of a referenced row. NO ACTION means that if any referencing rows still exist when the constraint is checked, an error is raised; this is the default behavior if you do not specify anything. (The essential difference between these two choices is that NO ACTION allows the check to be deferred until later in the transaction, whereas RESTRICT does not.) CASCADE specifies that when a referenced row is deleted, row(s) referencing it should be automatically deleted as well... -- Maxim Boguk лучшая поддержка PostgreSQL: dataegret.ru ... |
|||
:
Нравится:
Не нравится:
|
|||
13.06.2021, 01:40 |
|
|
start [/forum/topic.php?fid=53&fpage=10&tid=1993976]: |
0ms |
get settings: |
9ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
29ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
47ms |
get tp. blocked users: |
2ms |
others: | 251ms |
total: | 377ms |
0 / 0 |