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

Commit1bbd608

Browse files
committed
Split handling of reloptions for partitioned tables
Partitioned tables do not have relation options yet, but, similarly towhat's done for views which have their own parsing table, it could makesense to introduce new parameters for some of the existing default oneslike fillfactor, autovacuum, etc. Splitting things has the advantage tomake the information stored in rd_options include only the necessaryinformation, reducing the amount of memory used for a relcache entrywith partitioned tables if new reloptions are introduced at this level.Author: Nikolay ShaplovReviewed-by: Amit Langote, Michael PaquierDiscussion:https://postgr.es/m/1627387.Qykg9O6zpu@x200m
1 parent80ef34f commit1bbd608

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

‎src/backend/access/common/reloptions.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,9 +1099,11 @@ extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
10991099
caseRELKIND_RELATION:
11001100
caseRELKIND_TOASTVALUE:
11011101
caseRELKIND_MATVIEW:
1102-
caseRELKIND_PARTITIONED_TABLE:
11031102
options=heap_reloptions(classForm->relkind,datum, false);
11041103
break;
1104+
caseRELKIND_PARTITIONED_TABLE:
1105+
options=partitioned_table_reloptions(datum, false);
1106+
break;
11051107
caseRELKIND_VIEW:
11061108
options=view_reloptions(datum, false);
11071109
break;
@@ -1571,6 +1573,21 @@ build_reloptions(Datum reloptions, bool validate,
15711573
returnrdopts;
15721574
}
15731575

1576+
/*
1577+
* Option parser for partitioned tables
1578+
*/
1579+
bytea*
1580+
partitioned_table_reloptions(Datumreloptions,boolvalidate)
1581+
{
1582+
/*
1583+
* There are no options for partitioned tables yet, but this is able to do
1584+
* some validation.
1585+
*/
1586+
return (bytea*)build_reloptions(reloptions,validate,
1587+
RELOPT_KIND_PARTITIONED,
1588+
0,NULL,0);
1589+
}
1590+
15741591
/*
15751592
* Option parser for views
15761593
*/
@@ -1614,9 +1631,6 @@ heap_reloptions(char relkind, Datum reloptions, bool validate)
16141631
caseRELKIND_RELATION:
16151632
caseRELKIND_MATVIEW:
16161633
returndefault_reloptions(reloptions,validate,RELOPT_KIND_HEAP);
1617-
caseRELKIND_PARTITIONED_TABLE:
1618-
returndefault_reloptions(reloptions,validate,
1619-
RELOPT_KIND_PARTITIONED);
16201634
default:
16211635
/* other relkinds are not supported */
16221636
returnNULL;

‎src/backend/commands/tablecmds.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,17 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
719719
reloptions = transformRelOptions((Datum) 0, stmt->options, NULL, validnsps,
720720
true, false);
721721

722-
if (relkind == RELKIND_VIEW)
723-
(void) view_reloptions(reloptions, true);
724-
else
725-
(void) heap_reloptions(relkind, reloptions, true);
722+
switch (relkind)
723+
{
724+
case RELKIND_VIEW:
725+
(void) view_reloptions(reloptions, true);
726+
break;
727+
case RELKIND_PARTITIONED_TABLE:
728+
(void) partitioned_table_reloptions(reloptions, true);
729+
break;
730+
default:
731+
(void) heap_reloptions(relkind, reloptions, true);
732+
}
726733

727734
if (stmt->ofTypename)
728735
{
@@ -12187,9 +12194,11 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1218712194
case RELKIND_RELATION:
1218812195
case RELKIND_TOASTVALUE:
1218912196
case RELKIND_MATVIEW:
12190-
case RELKIND_PARTITIONED_TABLE:
1219112197
(void) heap_reloptions(rel->rd_rel->relkind, newOptions, true);
1219212198
break;
12199+
case RELKIND_PARTITIONED_TABLE:
12200+
(void) partitioned_table_reloptions(newOptions, true);
12201+
break;
1219312202
case RELKIND_VIEW:
1219412203
(void) view_reloptions(newOptions, true);
1219512204
break;

‎src/include/access/reloptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ extern bytea *default_reloptions(Datum reloptions, bool validate,
306306
relopt_kindkind);
307307
externbytea*heap_reloptions(charrelkind,Datumreloptions,boolvalidate);
308308
externbytea*view_reloptions(Datumreloptions,boolvalidate);
309+
externbytea*partitioned_table_reloptions(Datumreloptions,boolvalidate);
309310
externbytea*index_reloptions(amoptions_functionamoptions,Datumreloptions,
310311
boolvalidate);
311312
externbytea*attribute_reloptions(Datumreloptions,boolvalidate);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp