postgresql/doc/src/sgml/ref
Peter Eisentraut d6f96ed94e 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
2021-12-08 11:13:57 +01:00
..
abort.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
allfiles.sgml Add pg_amcheck, a CLI for contrib/amcheck. 2021-03-12 13:00:01 -05:00
alter_aggregate.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
alter_collation.sgml Doc: Update notes about libc collation versions. 2021-05-07 21:58:02 +12:00
alter_conversion.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_database.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_default_privileges.sgml Doc: clarify behavior of ALTER DEFAULT PRIVILEGES ... IN SCHEMA. 2019-11-19 14:21:41 -05:00
alter_domain.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
alter_event_trigger.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_extension.sgml Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
alter_foreign_data_wrapper.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_foreign_table.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
alter_function.sgml Doc: fix confusion about LEAKPROOF in syntax summaries. 2021-06-23 14:27:13 -04:00
alter_group.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
alter_index.sgml Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
alter_language.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_large_object.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_materialized_view.sgml Additional doc fixes for configurable TOAST compression. 2021-05-06 08:27:20 -04:00
alter_opclass.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_operator.sgml Remove support for postfix (right-unary) operators. 2020-09-17 19:38:05 -04:00
alter_opfamily.sgml Use the correct article for abbreviations 2021-06-11 13:38:04 +12:00
alter_policy.sgml doc: Improve hyphenation consistency 2021-04-21 08:14:43 +02:00
alter_procedure.sgml Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
alter_publication.sgml Allow publishing the tables of schema. 2021-10-27 07:44:52 +05:30
alter_role.sgml Allow users with BYPASSRLS to alter their own passwords. 2020-11-03 15:41:32 -05:00
alter_routine.sgml Doc: fix confusion about LEAKPROOF in syntax summaries. 2021-06-23 14:27:13 -04:00
alter_rule.sgml
alter_schema.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_sequence.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_server.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_statistics.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
alter_subscription.sgml doc: Fix some typos and markups 2021-09-29 11:56:13 +09:00
alter_system.sgml
alter_table.sgml Allow specifying column list for foreign key ON DELETE SET actions 2021-12-08 11:13:57 +01:00
alter_tablespace.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_trigger.sgml Make ALTER TRIGGER RENAME consistent for partitioned tables 2021-07-22 18:33:47 -04:00
alter_tsconfig.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_tsdictionary.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_tsparser.sgml
alter_tstemplate.sgml
alter_type.sgml Allow ALTER TYPE to update an existing type's typsubscript value. 2020-12-11 18:58:21 -05:00
alter_user.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
alter_user_mapping.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
alter_view.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
analyze.sgml Revert analyze support for partitioned tables 2021-08-16 17:27:52 -04:00
begin.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
call.sgml Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
checkpoint.sgml Add pg_checkpointer predefined role for CHECKPOINT command. 2021-11-09 16:59:14 -08:00
close.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
cluster.sgml doc: Fix man page whitespace issues 2021-04-09 23:36:46 +02:00
clusterdb.sgml Fix connection string handling in src/bin/scripts/ programs. 2020-10-19 19:03:46 -04:00
comment.sgml Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
commit.sgml Fix behavior of AND CHAIN outside of explicit transaction blocks 2019-09-08 16:23:03 +02:00
commit_prepared.sgml doc: Remove unused title ids 2020-03-13 15:45:37 +01:00
copy.sgml doc: \123 and \x12 escapes in COPY are in database encoding. 2021-08-17 10:00:06 +03:00
create_access_method.sgml
create_aggregate.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
create_cast.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
create_collation.sgml Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
create_conversion.sgml Add 'noError' argument to encoding conversion functions. 2021-04-01 11:45:22 +03:00
create_database.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
create_domain.sgml
create_event_trigger.sgml doc: Add missing markup in CREATE EVENT TRIGGER page 2021-09-25 14:48:03 +09:00
create_extension.sgml doc: Fix man page whitespace issues 2021-04-09 23:36:46 +02:00
create_foreign_data_wrapper.sgml
create_foreign_table.sgml Doc: be more precise about conflicts between relation names. 2021-11-02 12:12:02 -04:00
create_function.sgml Doc: fix confusion about LEAKPROOF in syntax summaries. 2021-06-23 14:27:13 -04:00
create_group.sgml Doc: sync CREATE GROUP syntax synopsis with CREATE ROLE. 2020-04-10 10:44:09 -04:00
create_index.sgml Doc: be more precise about conflicts between relation names. 2021-11-02 12:12:02 -04:00
create_language.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
create_materialized_view.sgml Doc: be more precise about conflicts between relation names. 2021-11-02 12:12:02 -04:00
create_opclass.sgml Use the correct article for abbreviations 2021-06-11 13:38:04 +12:00
create_operator.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
create_opfamily.sgml
create_policy.sgml doc: Improve hyphenation consistency 2021-04-21 08:14:43 +02:00
create_procedure.sgml doc: Fix man page whitespace issues 2021-04-09 23:36:46 +02:00
create_publication.sgml Doc: Add "Attach Partition" limitation during logical replication. 2021-12-01 10:07:45 +05:30
create_role.sgml Doc: get rid of <foreignphrase> tags. 2021-03-10 12:38:43 -05:00
create_rule.sgml
create_schema.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
create_sequence.sgml Doc: be more precise about conflicts between relation names. 2021-11-02 12:12:02 -04:00
create_server.sgml
create_statistics.sgml Use the correct article for abbreviations 2021-06-11 13:38:04 +12:00
create_subscription.sgml Doc: improve documentation of CREATE/ALTER SUBSCRIPTION. 2021-09-13 14:27:02 -04:00
create_table.sgml Allow specifying column list for foreign key ON DELETE SET actions 2021-12-08 11:13:57 +01:00
create_table_as.sgml Remove INSERT privilege check at table creation of CTAS and matview 2020-11-21 19:45:30 +09:00
create_tablespace.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
create_transform.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
create_trigger.sgml Doc: clarify how triggers relate to transactions. 2021-09-01 17:24:59 -04:00
create_tsconfig.sgml
create_tsdictionary.sgml
create_tsparser.sgml
create_tstemplate.sgml
create_type.sgml Fix some typos, grammar and style in docs and comments 2021-02-24 16:13:17 +09:00
create_user.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
create_user_mapping.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
create_view.sgml Doc: be more precise about conflicts between relation names. 2021-11-02 12:12:02 -04:00
createdb.sgml Fix connection string handling in src/bin/scripts/ programs. 2020-10-19 19:03:46 -04:00
createuser.sgml Fix typos and grammar in documentation and code comments 2021-04-09 13:53:07 +09:00
deallocate.sgml
declare.sgml Avoid misbehavior when persisting a non-stable cursor. 2021-06-08 17:50:29 -04:00
delete.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
discard.sgml Fix order of steps in DISCARD ALL documentation 2019-06-11 12:22:11 -04:00
do.sgml doc: Remove unused title ids 2020-03-13 15:45:37 +01:00
drop_access_method.sgml
drop_aggregate.sgml
drop_cast.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
drop_collation.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
drop_conversion.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
drop_database.sgml doc: Trim trailing whitespace 2020-06-07 13:24:40 +02:00
drop_domain.sgml
drop_event_trigger.sgml
drop_extension.sgml
drop_foreign_data_wrapper.sgml
drop_foreign_table.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
drop_function.sgml doc: Fix man page whitespace issues 2020-06-07 14:54:28 +02:00
drop_group.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
drop_index.sgml doc: Clarify use of ACCESS EXCLUSIVE lock in various sections 2021-04-01 15:28:37 +09:00
drop_language.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
drop_materialized_view.sgml
drop_opclass.sgml
drop_operator.sgml Remove support for postfix (right-unary) operators. 2020-09-17 19:38:05 -04:00
drop_opfamily.sgml
drop_owned.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
drop_policy.sgml doc: Improve hyphenation consistency 2021-04-21 08:14:43 +02:00
drop_procedure.sgml Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
drop_publication.sgml
drop_role.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
drop_routine.sgml Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
drop_rule.sgml
drop_schema.sgml
drop_sequence.sgml
drop_server.sgml
drop_statistics.sgml doc: Mention CASCADE/RESTRICT for DROP STATISTICS 2021-07-19 12:39:38 +09:00
drop_subscription.sgml Allow multiple xacts during table sync in logical replication. 2021-02-12 07:41:51 +05:30
drop_table.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
drop_tablespace.sgml
drop_transform.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
drop_trigger.sgml
drop_tsconfig.sgml
drop_tsdictionary.sgml
drop_tsparser.sgml
drop_tstemplate.sgml
drop_type.sgml
drop_user.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
drop_user_mapping.sgml Allow CURRENT_ROLE where CURRENT_USER is accepted 2020-09-17 11:40:08 +02:00
drop_view.sgml
dropdb.sgml Fix connection string handling in src/bin/scripts/ programs. 2020-10-19 19:03:46 -04:00
dropuser.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
ecpg-ref.sgml Fix our getopt_long's behavior for a command line argument of just "-". 2020-03-23 11:58:00 -04:00
end.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
execute.sgml Doc: fix "Unresolved ID reference" warnings, clean up man page cross-refs. 2020-05-11 14:15:55 -04:00
explain.sgml Make use of in-core query id added by commit 5fd9dfa5f5 2021-04-07 14:04:06 -04:00
fetch.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
grant.sgml Allow GRANTED BY clause in normal GRANT and REVOKE statements 2021-01-30 09:45:11 +01:00
import_foreign_schema.sgml
initdb.sgml Doc: clean up some places that mentioned template1 but not template0. 2021-11-02 12:54:35 -04:00
insert.sgml Doc: fix "Unresolved ID reference" warnings, clean up man page cross-refs. 2020-05-11 14:15:55 -04:00
listen.sgml Doc: improve discussion of race conditions involved in LISTEN. 2019-11-24 18:03:39 -05:00
load.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
lock.sgml Revert "Accept relations of any kind in LOCK TABLE". 2020-11-06 16:17:56 -05:00
move.sgml
notify.sgml Use a hash table to de-duplicate NOTIFY events faster. 2019-08-15 12:22:12 -04:00
pg_amcheck.sgml pg_amcheck: avoid unhelpful verification attempts. 2021-10-13 14:08:12 -07:00
pg_basebackup.sgml doc: Fix obsolete description about pg_basebackup. 2021-04-23 15:45:46 +09:00
pg_checksums.sgml Optimize pg_checksums --enable where checksum is already set 2021-06-30 09:58:59 +09:00
pg_config-ref.sgml Add missing <application> tags in application doc <refentrytitle>s 2020-07-10 16:51:29 +02:00
pg_controldata.sgml doc: remove unnecessary blank before command option text 2020-12-03 11:33:24 -05:00
pg_ctl-ref.sgml Revert "Add key management system" (978f869b99) & later commits 2020-12-27 21:37:42 -05:00
pg_dump.sgml Add support for prepared transactions to built-in logical replication. 2021-07-14 07:33:50 +05:30
pg_dumpall.sgml Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
pg_isready.sgml doc: libpq connection options can override command-line flags 2020-10-02 22:19:31 -04:00
pg_receivewal.sgml Add support for LZ4 compression in pg_receivewal 2021-11-05 11:33:25 +09:00
pg_recvlogical.sgml Allow enabling two-phase option via replication protocol. 2021-06-30 08:45:47 +05:30
pg_resetwal.sgml pg_resetxlog: add option to set oldest xid & use by pg_upgrade 2021-07-26 22:38:15 -04:00
pg_restore.sgml Revert analyze support for partitioned tables 2021-08-16 17:27:52 -04:00
pg_rewind.sgml Doc: Remove extraneous whitespaces with some tags 2021-04-24 10:44:13 +09:00
pg_verifybackup.sgml Fix typos and grammar in docs and comments 2020-12-24 17:05:49 +09:00
pg_waldump.sgml pg_waldump: Emit stats summary when interrupted by SIGINT 2021-12-02 13:52:16 +09:00
pgarchivecleanup.sgml Retire pg_standby. 2021-01-29 14:09:41 +13:00
pgbench.sgml pgbench: Improve error-handling in pgbench. 2021-11-02 22:49:57 +09:00
pgtestfsync.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
pgtesttiming.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
pgupgrade.sgml doc: mention pg_upgrade extension script 2021-08-08 21:05:46 -04:00
postgres-ref.sgml Introduce GUC shared_memory_size_in_huge_pages 2021-09-21 10:31:58 +09:00
postmaster.sgml doc: Remove unused ids 2020-03-07 14:04:09 +01:00
prepare.sgml Fix typos and grammar in docs and comments 2020-12-24 17:05:49 +09:00
prepare_transaction.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
psql-ref.sgml Allow publishing the tables of schema. 2021-10-27 07:44:52 +05:30
reassign_owned.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
refresh_materialized_view.sgml Doc: improve documentation about ORDER BY in matviews. 2021-11-29 12:13:12 -05:00
reindex.sgml Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
reindexdb.sgml Clarify that --system reindexes system catalogs *only* 2021-10-27 16:28:11 +02:00
release_savepoint.sgml
reset.sgml
revoke.sgml Allow GRANTED BY clause in normal GRANT and REVOKE statements 2021-01-30 09:45:11 +01:00
rollback.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
rollback_prepared.sgml doc: Remove unused title ids 2020-03-13 15:45:37 +01:00
rollback_to.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
savepoint.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
security_label.sgml Reconsider the handling of procedure OUT parameters. 2021-06-10 17:11:36 -04:00
select.sgml Error out if SKIP LOCKED and WITH TIES are both specified 2021-10-01 18:29:18 -03:00
select_into.sgml doc: Clarify status of SELECT INTO on reference page 2021-01-30 11:21:32 +01:00
set.sgml Doc: improve cross-references for SET/SHOW. 2021-01-29 10:46:14 -05:00
set_constraints.sgml doc: make ref/*.sgml file header comment layout consistent 2020-05-15 08:52:24 -04:00
set_role.sgml Clarify documentation of RESET ROLE 2021-04-02 13:48:42 -04:00
set_session_auth.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
set_transaction.sgml Doc: document the current-transaction-modes GUCs. 2021-07-17 11:52:54 -04:00
show.sgml Doc: improve cross-references for SET/SHOW. 2021-01-29 10:46:14 -05:00
start_transaction.sgml Improve <xref> vs. <command> formatting in the documentation 2020-10-03 16:40:02 +02:00
truncate.sgml doc: Review for "Allow TRUNCATE command to truncate foreign tables". 2021-04-27 18:39:30 +09:00
unlisten.sgml
update.sgml Doc: fix "Unresolved ID reference" warnings, clean up man page cross-refs. 2020-05-11 14:15:55 -04:00
vacuum.sgml Support disabling index bypassing by VACUUM. 2021-06-18 20:04:07 -07:00
vacuumdb.sgml Copy-edit vacuuumdb --analyze-in-stages doc blurb 2021-11-26 14:42:15 -03:00
values.sgml Doc: fix "Unresolved ID reference" warnings, clean up man page cross-refs. 2020-05-11 14:15:55 -04:00