mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Split handling of reloptions for partitioned tables
Partitioned tables do not have relation options yet, but, similarly to what's done for views which have their own parsing table, it could make sense to introduce new parameters for some of the existing default ones like fillfactor, autovacuum, etc. Splitting things has the advantage to make the information stored in rd_options include only the necessary information, reducing the amount of memory used for a relcache entry with partitioned tables if new reloptions are introduced at this level. Author: Nikolay Shaplov Reviewed-by: Amit Langote, Michael Paquier Discussion: https://postgr.es/m/1627387.Qykg9O6zpu@x200m
This commit is contained in:
@ -1099,9 +1099,11 @@ extractRelOptions(HeapTuple tuple, TupleDesc tupdesc,
|
||||
case RELKIND_RELATION:
|
||||
case RELKIND_TOASTVALUE:
|
||||
case RELKIND_MATVIEW:
|
||||
case RELKIND_PARTITIONED_TABLE:
|
||||
options = heap_reloptions(classForm->relkind, datum, false);
|
||||
break;
|
||||
case RELKIND_PARTITIONED_TABLE:
|
||||
options = partitioned_table_reloptions(datum, false);
|
||||
break;
|
||||
case RELKIND_VIEW:
|
||||
options = view_reloptions(datum, false);
|
||||
break;
|
||||
@ -1571,6 +1573,21 @@ build_reloptions(Datum reloptions, bool validate,
|
||||
return rdopts;
|
||||
}
|
||||
|
||||
/*
|
||||
* Option parser for partitioned tables
|
||||
*/
|
||||
bytea *
|
||||
partitioned_table_reloptions(Datum reloptions, bool validate)
|
||||
{
|
||||
/*
|
||||
* There are no options for partitioned tables yet, but this is able to do
|
||||
* some validation.
|
||||
*/
|
||||
return (bytea *) build_reloptions(reloptions, validate,
|
||||
RELOPT_KIND_PARTITIONED,
|
||||
0, NULL, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Option parser for views
|
||||
*/
|
||||
@ -1614,9 +1631,6 @@ heap_reloptions(char relkind, Datum reloptions, bool validate)
|
||||
case RELKIND_RELATION:
|
||||
case RELKIND_MATVIEW:
|
||||
return default_reloptions(reloptions, validate, RELOPT_KIND_HEAP);
|
||||
case RELKIND_PARTITIONED_TABLE:
|
||||
return default_reloptions(reloptions, validate,
|
||||
RELOPT_KIND_PARTITIONED);
|
||||
default:
|
||||
/* other relkinds are not supported */
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user