101 "Enables automatic summarization on this BRIN index",
109 "autovacuum_enabled",
110 "Enables autovacuum in this relation",
118 "user_catalog_table",
119 "Declare a table as an additional catalog table, e.g. for the purpose of logical replication",
128 "Enables \"fast update\" feature for this GIN index",
137 "View acts as a row security barrier",
145 "vacuum_index_cleanup",
146 "Enables index vacuuming and index cleanup",
155 "Enables vacuum to truncate empty pages at the end of this table",
170 "Packs table pages only to this percentage",
180 "Packs btree index pages only to this percentage",
190 "Packs hash index pages only to this percentage",
200 "Packs gist index pages only to this percentage",
210 "Packs spgist index pages only to this percentage",
219 "autovacuum_vacuum_threshold",
220 "Minimum number of tuple updates or deletes prior to vacuum",
228 "autovacuum_analyze_threshold",
229 "Minimum number of tuple inserts, updates or deletes prior to analyze",
237 "autovacuum_vacuum_cost_limit",
238 "Vacuum cost amount available before napping, for autovacuum",
246 "autovacuum_freeze_min_age",
247 "Minimum age at which VACUUM should freeze a table row, for autovacuum",
255 "autovacuum_multixact_freeze_min_age",
256 "Minimum multixact age at which VACUUM should freeze a row multixact's, for autovacuum",
264 "autovacuum_freeze_max_age",
265 "Age at which to autovacuum a table to prevent transaction ID wraparound",
269 -1, 100000, 2000000000
273 "autovacuum_multixact_freeze_max_age",
274 "Multixact age at which to autovacuum a table to prevent multixact wraparound",
278 -1, 10000, 2000000000
282 "autovacuum_freeze_table_age",
283 "Age at which VACUUM should perform a full table sweep to freeze row versions",
290 "autovacuum_multixact_freeze_table_age",
291 "Age of multixact at which VACUUM should perform a full table sweep to freeze row versions",
298 "log_autovacuum_min_duration",
299 "Sets the minimum execution time above which autovacuum actions will be logged",
307 "toast_tuple_target",
308 "Sets the target tuple length at which external columns will be toasted",
317 "Number of pages that each page range covers in a BRIN index",
324 "gin_pending_list_limit",
325 "Maximum size of the pending list for this GIN index, in kilobytes.",
333 "effective_io_concurrency",
334 "Number of simultaneous requests that can be handled efficiently by the disk subsystem.",
347 "Number of parallel processes that can be used per executor node for this relation.",
362 "autovacuum_vacuum_cost_delay",
363 "Vacuum cost delay in milliseconds, for autovacuum",
371 "autovacuum_vacuum_scale_factor",
372 "Number of tuple updates or deletes prior to vacuum as a fraction of reltuples",
380 "autovacuum_analyze_scale_factor",
381 "Number of tuple inserts, updates or deletes prior to analyze as a fraction of reltuples",
390 "Sets the planner's estimate of the cost of a sequentially fetched disk page.",
399 "Sets the planner's estimate of the cost of a nonsequentially fetched disk page.",
408 "Sets the planner's estimate of the number of distinct values appearing in a column (excluding child relations).",
416 "n_distinct_inherited",
417 "Sets the planner's estimate of the number of distinct values appearing in a column (including child relations).",
425 "vacuum_cleanup_index_scale_factor",
426 "Number of tuple inserts prior to index cleanup as a fraction of reltuples.",
442 {(
const char *) NULL}
451 {(
const char *) NULL}
459 "Enables buffering build for this GiST index",
465 gettext_noop(
"Valid values are \"on\", \"off\", and \"auto\".")
470 "View has WITH CHECK OPTION defined (local or cascaded).",
476 gettext_noop(
"Valid values are \"local\" and \"cascaded\".")
497 int text_len,
bool validate);
504 #define GET_STRING_RELOPTION_LEN(option) \ 505 ((option).isset ? strlen((option).values.string_val) : \ 506 ((relopt_string *) (option).gen)->default_len) 521 for (i = 0; boolRelOpts[
i].
gen.
name; i++)
527 for (i = 0; intRelOpts[
i].
gen.
name; i++)
533 for (i = 0; realRelOpts[
i].
gen.
name; i++)
539 for (i = 0; enumRelOpts[
i].
gen.
name; i++)
545 for (i = 0; stringRelOpts[
i].
gen.
name; i++)
559 for (i = 0; boolRelOpts[
i].
gen.
name; i++)
561 relOpts[j] = &boolRelOpts[
i].
gen;
567 for (i = 0; intRelOpts[
i].
gen.
name; i++)
569 relOpts[j] = &intRelOpts[
i].
gen;
575 for (i = 0; realRelOpts[
i].
gen.
name; i++)
577 relOpts[j] = &realRelOpts[
i].
gen;
583 for (i = 0; enumRelOpts[
i].
gen.
name; i++)
585 relOpts[j] = &enumRelOpts[
i].
gen;
591 for (i = 0; stringRelOpts[
i].
gen.
name; i++)
593 relOpts[j] = &stringRelOpts[
i].
gen;
601 relOpts[j] = custom_options[
i];
623 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
624 errmsg(
"user-defined relation parameter types limit exceeded")));
637 static int max_custom_options = 0;
645 if (max_custom_options == 0)
647 max_custom_options = 8;
652 max_custom_options *= 2;
653 custom_options =
repalloc(custom_options,
696 elog(
ERROR,
"unsupported reloption type %d", type);
706 newoption->
desc = NULL;
707 newoption->
kinds = kinds;
708 newoption->
namelen = strlen(name);
723 bool default_val,
LOCKMODE lockmode)
728 name, desc, lockmode);
740 int min_val,
int max_val,
LOCKMODE lockmode)
745 name, desc, lockmode);
747 newoption->
min = min_val;
748 newoption->
max = max_val;
759 double min_val,
double max_val,
LOCKMODE lockmode)
764 name, desc, lockmode);
766 newoption->
min = min_val;
767 newoption->
max = max_val;
787 const char *detailmsg,
LOCKMODE lockmode)
792 name, desc, lockmode);
817 (validator) (default_val);
820 name, desc, lockmode);
864 char *validnsps[],
bool acceptOidsOff,
bool isReset)
886 &oldoptions, NULL, &noldoptions);
888 for (i = 0; i < noldoptions; i++)
890 char *text_str =
VARDATA(oldoptions[i]);
894 foreach(cell, defList)
900 if (namspace == NULL)
911 if (text_len > kw_len && text_str[kw_len] ==
'=' &&
912 strncmp(text_str, def->
defname, kw_len) == 0)
930 foreach(cell, defList)
936 if (def->
arg != NULL)
938 (
errcode(ERRCODE_SYNTAX_ERROR),
939 errmsg(
"RESET must not include values for parameters")));
958 for (i = 0; validnsps[
i]; i++)
970 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
971 errmsg(
"unrecognized parameter namespace \"%s\"",
976 if (namspace == NULL)
991 if (def->
arg != NULL)
1003 strcmp(def->
defname,
"oids") == 0)
1007 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1008 errmsg(
"tables declared WITH OIDS are not supported")));
1043 Datum *optiondatums;
1054 &optiondatums, NULL, &noptions);
1097 Anum_pg_class_reloptions,
1106 switch (classForm->relkind)
1108 case RELKIND_RELATION:
1109 case RELKIND_TOASTVALUE:
1110 case RELKIND_MATVIEW:
1113 case RELKIND_PARTITIONED_TABLE:
1120 case RELKIND_PARTITIONED_INDEX:
1123 case RELKIND_FOREIGN_TABLE:
1168 for (i = 0; relOpts[
i]; i++)
1169 if (relOpts[i]->kinds & kind)
1176 for (i = 0, j = 0; relOpts[
i]; i++)
1178 if (relOpts[i]->kinds & kind)
1180 reloptions[j].
gen = relOpts[
i];
1181 reloptions[j].
isset =
false;
1191 Datum *optiondatums;
1195 &optiondatums, NULL, &noptions);
1199 char *text_str =
VARDATA(optiondatums[i]);
1204 for (j = 0; j < numoptions; j++)
1208 if (text_len > kw_len && text_str[kw_len] ==
'=' &&
1209 strncmp(text_str, reloptions[j].gen->name, kw_len) == 0)
1217 if (j >= numoptions && validate)
1227 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1228 errmsg(
"unrecognized parameter \"%s\"", s)));
1233 pfree(optiondatums);
1238 *numrelopts = numoptions;
1253 bool nofree =
false;
1255 if (option->
isset && validate)
1257 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1258 errmsg(
"parameter \"%s\" specified more than once",
1261 value_len = text_len - option->
gen->
namelen - 1;
1262 value = (
char *)
palloc(value_len + 1);
1263 memcpy(value, text_str + option->
gen->
namelen + 1, value_len);
1264 value[value_len] =
'\0';
1271 if (validate && !parsed)
1273 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1274 errmsg(
"invalid value for boolean option \"%s\": %s",
1283 if (validate && !parsed)
1285 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1286 errmsg(
"invalid value for integer option \"%s\": %s",
1291 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1292 errmsg(
"value %s out of bounds for option \"%s\"",
1294 errdetail(
"Valid values are between \"%d\" and \"%d\".",
1295 optint->
min, optint->
max)));
1303 if (validate && !parsed)
1305 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1306 errmsg(
"invalid value for floating point option \"%s\": %s",
1311 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1312 errmsg(
"value %s out of bounds for option \"%s\"",
1314 errdetail(
"Valid values are between \"%f\" and \"%f\".",
1315 optreal->
min, optreal->
max)));
1333 if (validate && !parsed)
1335 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1336 errmsg(
"invalid value for enum option \"%s\": %s",
1367 option->
isset =
true;
1385 for (i = 0; i < numoptions; i++)
1410 int offset = basesize;
1412 for (i = 0; i < numoptions; i++)
1417 for (j = 0; j < numelems; j++)
1419 if (strcmp(options[i].gen->name, elems[j].
optname) == 0)
1422 char *itempos = ((
char *) rdopts) + elems[j].
offset;
1425 switch (options[i].gen->type)
1428 *(
bool *) itempos = options[i].isset ?
1429 options[i].
values.bool_val :
1433 *(
int *) itempos = options[i].isset ?
1434 options[i].
values.int_val :
1438 *(
double *) itempos = options[i].isset ?
1439 options[i].
values.real_val :
1443 *(
int *) itempos = options[i].isset ?
1444 options[i].
values.enum_val :
1449 if (options[i].isset)
1456 if (string_val == NULL)
1457 *(
int *) itempos = 0;
1460 strcpy((
char *) rdopts + offset, string_val);
1461 *(
int *) itempos = offset;
1462 offset += strlen(string_val) + 1;
1466 elog(
ERROR,
"unsupported reloption type %d",
1467 options[i].gen->type);
1474 if (validate && !found)
1475 elog(
ERROR,
"reloption \"%s\" not found in parse table",
1476 options[i].gen->name);
1554 Size relopt_struct_size,
1556 int num_relopt_elems)
1564 Assert(numoptions <= num_relopt_elems);
1567 if (numoptions == 0)
1576 validate, relopt_elems, num_relopt_elems);
1627 case RELKIND_TOASTVALUE:
1637 return (
bytea *) rdopts;
1638 case RELKIND_RELATION:
1639 case RELKIND_MATVIEW:
1658 Assert(amoptions != NULL);
1664 return amoptions(reloptions, validate);
1720 foreach(cell, defList)
1725 for (i = 0; relOpts[
i]; i++)
1727 if (strncmp(relOpts[i]->
name,
1729 relOpts[i]->
namelen + 1) == 0)
1731 if (lockmode < relOpts[i]->lockmode)
Value * makeString(char *str)
#define HASH_DEFAULT_FILLFACTOR
bytea * heap_reloptions(char relkind, Datum reloptions, bool validate)
#define MAX_IO_CONCURRENCY
static void initialize_reloptions(void)
#define HASH_MIN_FILLFACTOR
static relopt_gen ** custom_options
#define SPGIST_MIN_FILLFACTOR
struct relopt_string relopt_string
#define fastgetattr(tup, attnum, tupleDesc, isnull)
Datum transformRelOptions(Datum oldOptions, List *defList, const char *namspace, char *validnsps[], bool acceptOidsOff, bool isReset)
struct relopt_enum relopt_enum
#define PointerGetDatum(X)
char * pstrdup(const char *in)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static relopt_bool boolRelOpts[]
bytea * tablespace_reloptions(Datum reloptions, bool validate)
int errcode(int sqlerrcode)
static void * allocateReloptStruct(Size base, relopt_value *options, int numoptions)
bool parse_real(const char *value, double *result, int flags, const char **hintmsg)
bool parse_bool(const char *value, bool *result)
relopt_enum_elt_def gistBufferingOptValues[]
int pg_strcasecmp(const char *s1, const char *s2)
void add_int_reloption(bits32 kinds, const char *name, const char *desc, int default_val, int min_val, int max_val, LOCKMODE lockmode)
struct relopt_bool relopt_bool
DefElem * makeDefElem(char *name, Node *arg, int location)
int effective_io_concurrency
bytea * attribute_reloptions(Datum reloptions, bool validate)
#define TOAST_TUPLE_TARGET
void * build_reloptions(Datum reloptions, bool validate, relopt_kind kind, Size relopt_struct_size, const relopt_parse_elt *relopt_elems, int num_relopt_elems)
int errdetail_internal(const char *fmt,...)
#define GET_STRING_RELOPTION_LEN(option)
struct relopt_real relopt_real
bytea * view_reloptions(Datum reloptions, bool validate)
#define SPGIST_DEFAULT_FILLFACTOR
bool defGetBoolean(DefElem *def)
void pfree(void *pointer)
static relopt_gen * allocate_reloption(bits32 kinds, int type, const char *name, const char *desc, LOCKMODE lockmode)
static void parse_one_reloption(relopt_value *option, char *text_str, int text_len, bool validate)
static int num_custom_options
char * defGetString(DefElem *def)
union relopt_value::@47 values
bool DoLockModesConflict(LOCKMODE mode1, LOCKMODE mode2)
static relopt_real realRelOpts[]
static void fillRelOptions(void *rdopts, Size basesize, relopt_value *options, int numoptions, bool validate, const relopt_parse_elt *elems, int numelems)
int errdetail(const char *fmt,...)
relopt_enum_elt_def * members
MemoryContext CurrentMemoryContext
#define GIST_DEFAULT_FILLFACTOR
#define TOAST_TUPLE_TARGET_MAIN
#define ereport(elevel, rest)
Datum makeArrayResult(ArrayBuildState *astate, MemoryContext rcontext)
#define BTREE_DEFAULT_FILLFACTOR
static relopt_value * parseRelOptions(Datum options, bool validate, relopt_kind kind, int *numrelopts)
validate_string_relopt validate_cb
MemoryContext TopMemoryContext
List * lappend(List *list, void *datum)
#define BTREE_MIN_FILLFACTOR
bytea * partitioned_table_reloptions(Datum reloptions, bool validate)
relopt_enum_elt_def viewCheckOptValues[]
#define TextDatumGetCString(d)
void * palloc0(Size size)
bool parse_int(const char *value, int *result, int flags, const char **hintmsg)
List * untransformRelOptions(Datum options)
bytea * extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, amoptions_function amoptions)
bytea * index_reloptions(amoptions_function amoptions, Datum reloptions, bool validate)
float8 analyze_scale_factor
#define ShareUpdateExclusiveLock
#define Assert(condition)
void(* validate_string_relopt)(const char *value)
#define HEAP_MIN_FILLFACTOR
#define GIST_MIN_FILLFACTOR
struct relopt_int relopt_int
void add_real_reloption(bits32 kinds, const char *name, const char *desc, double default_val, double min_val, double max_val, LOCKMODE lockmode)
static void add_reloption(relopt_gen *newoption)
void * repalloc(void *pointer, Size size)
LOCKMODE AlterTableGetRelOptionsLockLevel(List *defList)
static relopt_string stringRelOpts[]
relopt_kind add_reloption_kind(void)
#define DatumGetPointer(X)
void deconstruct_array(ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
static Datum values[MAXATTR]
FormData_pg_class * Form_pg_class
ArrayBuildState * accumArrayResult(ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext)
#define AccessExclusiveLock
bytea * default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
int errmsg(const char *fmt,...)
void add_string_reloption(bits32 kinds, const char *name, const char *desc, const char *default_val, validate_string_relopt validator, LOCKMODE lockmode)
char * MemoryContextStrdup(MemoryContext context, const char *string)
void * MemoryContextAlloc(MemoryContext context, Size size)
static bool need_initialization
#define SET_VARSIZE(PTR, len)
bytea *(* amoptions_function)(Datum reloptions, bool validate)
static relopt_enum enumRelOpts[]
#define HEAP_DEFAULT_FILLFACTOR
static relopt_int intRelOpts[]
static relopt_gen ** relOpts
void add_enum_reloption(bits32 kinds, const char *name, const char *desc, relopt_enum_elt_def *members, int default_val, const char *detailmsg, LOCKMODE lockmode)
static bits32 last_assigned_kind
void add_bool_reloption(bits32 kinds, const char *name, const char *desc, bool default_val, LOCKMODE lockmode)
#define PointerIsValid(pointer)
#define offsetof(type, field)
#define DatumGetArrayTypeP(X)