Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7f70d5

Browse files
committed
Create composite array types for initdb-created relations.
When we invented arrays of composite types (commitbc8036f),we excluded system catalogs, basically just on the grounds of notwanting to bloat pg_type. However, it's definitely inconsistent thatcatalogs' composite types can't be put into arrays when others can.Another problem is that the exclusion is done by checkingIsUnderPostmaster in heap_create_with_catalog, which means that(1) If a user tries to create a table in single-user mode, it doesn'tget an array type. That's bad in itself, plus it breaks pg_upgrade.(2) If someone drops and recreates a system view or information_schemaview (as we occasionally recommend doing), it will now have an arraytype where it did not before, making for still more inconsistency.So this is all pretty messy. Let's just get rid of the inconsistencyand decree that system-created relations should have array types ifsimilar user-created ones would, i.e. it only depends on the relkind.As of HEAD, that means that the initial contents of pg_type grow from411 rows to 605, which is a lot of growth percentage-wise, but it'sstill quite a small catalog compared to others.Wenjing Zeng, reviewed by Shawn Wang, further hacking by meDiscussion:https://postgr.es/m/761F1389-C6A8-4C15-80CE-950C961F5341@gmail.com
1 parentbae9e8a commitf7f70d5

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

‎src/backend/catalog/heap.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,17 +1262,14 @@ heap_create_with_catalog(const char *relname,
12621262
new_rel_desc->rd_rel->relrewrite=relrewrite;
12631263

12641264
/*
1265-
* Decide whether to create an array type over the relation's rowtype. We
1266-
* do not create any array types for system catalogs (ie, those made
1267-
* during initdb). We do not create them where the use of a relation as
1268-
* such is an implementation detail: toast tables, sequences and indexes.
1269-
*/
1270-
if (IsUnderPostmaster&& (relkind==RELKIND_RELATION||
1271-
relkind==RELKIND_VIEW||
1272-
relkind==RELKIND_MATVIEW||
1273-
relkind==RELKIND_FOREIGN_TABLE||
1274-
relkind==RELKIND_COMPOSITE_TYPE||
1275-
relkind==RELKIND_PARTITIONED_TABLE))
1265+
* Decide whether to create an array type over the relation's rowtype.
1266+
* Array types are made except where the use of a relation as such is an
1267+
* implementation detail: toast tables, sequences and indexes.
1268+
*/
1269+
if (!(relkind==RELKIND_SEQUENCE||
1270+
relkind==RELKIND_TOASTVALUE||
1271+
relkind==RELKIND_INDEX||
1272+
relkind==RELKIND_PARTITIONED_INDEX))
12761273
new_array_oid=AssignTypeArrayOid();
12771274

12781275
/*

‎src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/*yyyymmddN */
56-
#defineCATALOG_VERSION_NO202006301
56+
#defineCATALOG_VERSION_NO202007061
5757

5858
#endif

‎src/include/catalog/pg_type.dat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,22 @@
113113

114114
# hand-built rowtype entries for bootstrapped catalogs
115115
# NB: OIDs assigned here must match the BKI_ROWTYPE_OID declarations
116-
{ oid => '71',
116+
{ oid => '71', array_type_oid => '210',
117117
typname => 'pg_type', typlen => '-1', typbyval => 'f', typtype => 'c',
118118
typcategory => 'C', typrelid => 'pg_type', typinput => 'record_in',
119119
typoutput => 'record_out', typreceive => 'record_recv',
120120
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
121-
{ oid => '75',
121+
{ oid => '75', array_type_oid => '270',
122122
typname => 'pg_attribute', typlen => '-1', typbyval => 'f', typtype => 'c',
123123
typcategory => 'C', typrelid => 'pg_attribute', typinput => 'record_in',
124124
typoutput => 'record_out', typreceive => 'record_recv',
125125
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
126-
{ oid => '81',
126+
{ oid => '81', array_type_oid => '272',
127127
typname => 'pg_proc', typlen => '-1', typbyval => 'f', typtype => 'c',
128128
typcategory => 'C', typrelid => 'pg_proc', typinput => 'record_in',
129129
typoutput => 'record_out', typreceive => 'record_recv',
130130
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
131-
{ oid => '83',
131+
{ oid => '83', array_type_oid => '273',
132132
typname => 'pg_class', typlen => '-1', typbyval => 'f', typtype => 'c',
133133
typcategory => 'C', typrelid => 'pg_class', typinput => 'record_in',
134134
typoutput => 'record_out', typreceive => 'record_recv',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp