postgresql/src/backend/catalog
Robert Haas 9c08aea6a3 Add new block-by-block strategy for CREATE DATABASE.
Because this strategy logs changes on a block-by-block basis, it
avoids the need to checkpoint before and after the operation.
However, because it logs each changed block individually, it might
generate a lot of extra write-ahead logging if the template database
is large. Therefore, the older strategy remains available via a new
STRATEGY parameter to CREATE DATABASE, and a corresponding --strategy
option to createdb.

Somewhat controversially, this patch assembles the list of relations
to be copied to the new database by reading the pg_class relation of
the template database. Cross-database access like this isn't normally
possible, but it can be made to work here because there can't be any
connections to the database being copied, nor can it contain any
in-doubt transactions. Even so, we have to use lower-level interfaces
than normal, since the table scan and relcache interfaces will not
work for a database to which we're not connected. The advantage of
this approach is that we do not need to rely on the filesystem to
determine what ought to be copied, but instead on PostgreSQL's own
knowledge of the database structure. This avoids, for example,
copying stray files that happen to be located in the source database
directory.

Dilip Kumar, with a fairly large number of cosmetic changes by me.
Reviewed and tested by Ashutosh Sharma, Andres Freund, John Naylor,
Greg Nancarrow, Neha Sharma. Additional feedback from Bruce Momjian,
Heikki Linnakangas, Julien Rouhaud, Adam Brusselback, Kyotaro
Horiguchi, Tomas Vondra, Andrew Dunstan, Álvaro Herrera, and others.

Discussion: http://postgr.es/m/CA+TgmoYtcdxBjLh31DLxUXHxFVMPGzrU5_T=CYCvRyFHywSBUQ@mail.gmail.com
2022-03-29 11:48:36 -04:00
..
.gitignore Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
Catalog.pm Update copyright for 2022 2022-01-07 19:04:57 -05:00
Makefile Move pg_attrdef manipulation code into new file catalog/pg_attrdef.c. 2022-03-21 14:38:23 -04:00
aclchk.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
catalog.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
dependency.c Remove unnecessary translator comment 2022-03-24 14:07:38 +01:00
genbki.pl Update copyright for 2022 2022-01-07 19:04:57 -05:00
heap.c Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
index.c pgstat: introduce pgstat_relation_should_count(). 2022-03-20 19:12:09 -07:00
indexing.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
information_schema.sql Fix bogus dependency handling for GENERATED expressions. 2022-03-21 14:58:49 -04:00
namespace.c Fix temporary object cleanup failing due to toast access without snapshot. 2022-02-21 08:57:34 -08:00
objectaccess.c Add String object access hooks 2022-03-22 10:28:31 -04:00
objectaddress.c Add decoding of sequences to built-in replication 2022-03-24 18:49:27 +01:00
partition.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_aggregate.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_attrdef.c Fix bogus dependency handling for GENERATED expressions. 2022-03-21 14:58:49 -04:00
pg_cast.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_class.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_collation.c Add option to use ICU as global locale provider 2022-03-17 11:13:16 +01:00
pg_constraint.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_conversion.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_db_role_setting.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_depend.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_enum.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_inherits.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_largeobject.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_namespace.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_operator.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_proc.c Parse/analyze function renaming 2022-03-04 14:50:22 +01:00
pg_publication.c Suppress compiler warning in pub_collist_to_bitmapset(). 2022-03-26 11:53:37 -04:00
pg_range.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_shdepend.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_subscription.c Add ALTER SUBSCRIPTION ... SKIP. 2022-03-22 07:11:19 +05:30
pg_type.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
sql_feature_packages.txt Cleanup in SQL features files 2020-03-28 08:46:18 +01:00
sql_features.txt Add support for MERGE SQL command 2022-03-28 16:47:48 +02:00
storage.c Add new block-by-block strategy for CREATE DATABASE. 2022-03-29 11:48:36 -04:00
system_functions.sql Fix catalog data of pg_stop_backup(), labelled v2 2022-03-03 10:51:57 +09:00
system_views.sql Add system view pg_ident_file_mappings 2022-03-29 10:15:48 +09:00
toasting.c Add UNIQUE null treatment option 2022-02-03 11:48:21 +01:00