pgsql: Add pg_get_tablespace_ddl() function
pgsql: Add pg_get_tablespace_ddl() function
От:
Andrew Dunstan <andrew@dunslane.net>
Дата:
Add pg_get_tablespace_ddl() function Add a new SQL-callable function that returns the DDL statements needed to recreate a tablespace. It takes a tablespace name or OID and an optional VARIADIC text argument for options that are specified as alternating name/value pairs. The following options are supported: pretty (boolean) for formatted output and owner (boolean) to include OWNER. (It includes two variants because there is no regtablespace pseudotype.) The return is one or multiple rows where the first row is a CREATE TABLESPACE statement and subsequent rows are ALTER TABLESPACE statements to set some tablespace properties. The caller must have SELECT privilege on pg_tablespace. get_reloptions() in ruleutils.c is made non-static so it can be called from the new ddlutils.c file. Author: Nishant Sharma Author: Manni Wood Co-authored-by: Andrew Dunstan Co-authored-by: Euler Taveira Reviewed-by: Jim Jones Reviewed-by: Álvaro Herrera Reviewed-by: Chao Li Discussion: https://postgr.es/m/CAKWEB6rmnmGKUA87Zmq-s=b3Scsnj02C0kObQjnbL2ajfPWGEw@mail.gmail.com Discussion: https://postgr.es/m/e247c261-e3fb-4810-81e0-a65893170e94@dunslane.net Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b99fd9fd7f363c6363f4c8a95c699b9134b0357f Modified Files -------------- doc/src/sgml/func/func-info.sgml | 28 ++++ src/backend/utils/adt/ddlutils.c | 206 ++++++++++++++++++++++++++- src/backend/utils/adt/ruleutils.c | 4 +- src/include/catalog/pg_proc.dat | 16 +++ src/include/utils/ruleutils.h | 1 + src/test/regress/expected/tablespace_ddl.out | 84 +++++++++++ src/test/regress/parallel_schedule | 2 +- src/test/regress/sql/tablespace_ddl.sql | 58 ++++++++ 8 files changed, 395 insertions(+), 4 deletions(-)