Introduce the 'force' option for the Drop Database command.
authorAmit Kapila <[email protected]>
Tue, 12 Nov 2019 05:36:13 +0000 (11:06 +0530)
committerAmit Kapila <[email protected]>
Wed, 13 Nov 2019 02:55:33 +0000 (08:25 +0530)
commit1379fd537f9fc7941c8acff8c879ce3636dbdb77
tree7f74fd3cf0367c76ee511c14949c96e740a25916
parent112caf9039f4c8fb286bb610461ced8253313e9f
Introduce the 'force' option for the Drop Database command.

This new option terminates the other sessions connected to the target
database and then drop it.  To terminate other sessions, the current user
must have desired permissions (same as pg_terminate_backend()).  We don't
allow to terminate the sessions if prepared transactions, active logical
replication slots or subscriptions are present in the target database.

Author: Pavel Stehule with changes by me
Reviewed-by: Dilip Kumar, Vignesh C, Ibrar Ahmed, Anthony Nowocien,
Ryan Lambert and Amit Kapila
Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com
13 files changed:
doc/src/sgml/ref/drop_database.sgml
src/backend/commands/dbcommands.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/parser/gram.y
src/backend/storage/ipc/procarray.c
src/backend/tcop/utility.c
src/bin/psql/tab-complete.c
src/include/commands/dbcommands.h
src/include/nodes/parsenodes.h
src/include/storage/procarray.h
src/test/regress/expected/drop_if_exists.out
src/test/regress/sql/drop_if_exists.sql