Add pg_get_database_ddl() function Add a new SQL-callable function that returns the DDL statements needed to recreate a database. It takes a regdatabase argument 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, owner (boolean) to include OWNER and tablespace (boolean) to include TABLESPACE. The return is one or multiple rows where the first row is a CREATE DATABASE statement and subsequent rows are ALTER DATABASE statements to set some database properties.
The caller must have CONNECT privilege on the target database. Author: Akshay Joshi <[email protected]> Co-authored-by: Andrew Dunstan <[email protected]> Co-authored-by: Euler Taveira <[email protected]> Reviewed-by: Japin Li <[email protected]> Reviewed-by: Chao Li <[email protected]> Reviewed-by: Álvaro Herrera <[email protected]> Reviewed-by: Quan Zongliang <[email protected]> Discussion: https://postgr.es/m/canxoldc6fhbyjvcgonzys+jf0nuo3lq_83-rttbujgs9id_...@mail.gmail.com Discussion: https://postgr.es/m/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/a4f774cf1c7e5c6cf2f3393f611e1df16cdb5a5a Modified Files -------------- doc/src/sgml/func/func-info.sgml | 23 ++ src/backend/utils/adt/ddlutils.c | 330 +++++++++++++++++++++++++++++ src/include/catalog/pg_proc.dat | 8 + src/test/regress/expected/database_ddl.out | 88 ++++++++ src/test/regress/parallel_schedule | 2 +- src/test/regress/sql/database_ddl.sql | 66 ++++++ 6 files changed, 516 insertions(+), 1 deletion(-)
