diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2021-12-08 11:09:44 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2021-12-08 11:13:57 +0100 |
commit | d6f96ed94e73052f99a2e545ed17a8b2fdc1fb8a (patch) | |
tree | 621d033b72ab7da8a21acb729b41c015b6322747 /src/include/nodes/parsenodes.h | |
parent | e464cb7af317e216fef9bfe19a7c4df542817012 (diff) | |
download | postgresql-d6f96ed94e73052f99a2e545ed17a8b2fdc1fb8a.tar.gz postgresql-d6f96ed94e73052f99a2e545ed17a8b2fdc1fb8a.zip |
Allow specifying column list for foreign key ON DELETE SET actions
Extend the foreign key ON DELETE actions SET NULL and SET DEFAULT by
allowing the specification of a column list, like
CREATE TABLE posts (
...
FOREIGN KEY (tenant_id, author_id) REFERENCES users ON DELETE SET NULL (author_id)
);
If a column list is specified, only those columns are set to
null/default, instead of all the columns in the foreign-key
constraint.
This is useful for multitenant or sharded schemas, where the tenant or
shard ID is included in the primary key of all tables but shouldn't be
set to null.
Author: Paul Martinez <paulmtz@google.com>
Discussion: https://www.postgresql.org/message-id/flat/CACqFVBZQyMYJV=njbSMxf+rbDHpx=W=B7AEaMKn8dWn9OZJY7w@mail.gmail.com
Diffstat (limited to 'src/include/nodes/parsenodes.h')
-rw-r--r-- | src/include/nodes/parsenodes.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 067138e6b59..4c5a8a39bf1 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -2301,6 +2301,7 @@ typedef struct Constraint char fk_matchtype; /* FULL, PARTIAL, SIMPLE */ char fk_upd_action; /* ON UPDATE action */ char fk_del_action; /* ON DELETE action */ + List *fk_del_set_cols; /* ON DELETE SET NULL/DEFAULT (col1, col2) */ List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */ Oid old_pktable_oid; /* pg_constraint.confrelid of my former * self */ |