PostgreSQL Source Code git master
|
#include "postgres.h"
#include <float.h>
#include "access/gist_private.h"
#include "access/hash.h"
#include "access/heaptoast.h"
#include "access/htup_details.h"
#include "access/nbtree.h"
#include "access/reloptions.h"
#include "access/spgist_private.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
#include "commands/tablespace.h"
#include "nodes/makefuncs.h"
#include "utils/array.h"
#include "utils/attoptcache.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "utils/memutils.h"
#include "utils/rel.h"
Go to the source code of this file.
Macros | |
#define | GET_STRING_RELOPTION_LEN(option) |
Functions | |
static void | initialize_reloptions (void) |
static void | parse_one_reloption (relopt_value *option, char *text_str, int text_len, bool validate) |
relopt_kind | add_reloption_kind (void) |
static void | add_reloption (relopt_gen *newoption) |
void | init_local_reloptions (local_relopts *relopts, Size relopt_struct_size) |
void | register_reloptions_validator (local_relopts *relopts, relopts_validator validator) |
static void | add_local_reloption (local_relopts *relopts, relopt_gen *newoption, int offset) |
static relopt_gen * | allocate_reloption (bits32 kinds, int type, const char *name, const char *desc, LOCKMODE lockmode) |
static relopt_bool * | init_bool_reloption (bits32 kinds, const char *name, const char *desc, bool default_val, LOCKMODE lockmode) |
void | add_bool_reloption (bits32 kinds, const char *name, const char *desc, bool default_val, LOCKMODE lockmode) |
void | add_local_bool_reloption (local_relopts *relopts, const char *name, const char *desc, bool default_val, int offset) |
static relopt_int * | init_int_reloption (bits32 kinds, const char *name, const char *desc, int default_val, int min_val, int max_val, LOCKMODE lockmode) |
void | add_int_reloption (bits32 kinds, const char *name, const char *desc, int default_val, int min_val, int max_val, LOCKMODE lockmode) |
void | add_local_int_reloption (local_relopts *relopts, const char *name, const char *desc, int default_val, int min_val, int max_val, int offset) |
static relopt_real * | init_real_reloption (bits32 kinds, const char *name, const char *desc, double default_val, double min_val, double max_val, LOCKMODE lockmode) |
void | add_real_reloption (bits32 kinds, const char *name, const char *desc, double default_val, double min_val, double max_val, LOCKMODE lockmode) |
void | add_local_real_reloption (local_relopts *relopts, const char *name, const char *desc, double default_val, double min_val, double max_val, int offset) |
static relopt_enum * | init_enum_reloption (bits32 kinds, const char *name, const char *desc, relopt_enum_elt_def *members, int default_val, const char *detailmsg, LOCKMODE lockmode) |
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) |
void | add_local_enum_reloption (local_relopts *relopts, const char *name, const char *desc, relopt_enum_elt_def *members, int default_val, const char *detailmsg, int offset) |
static relopt_string * | init_string_reloption (bits32 kinds, const char *name, const char *desc, const char *default_val, validate_string_relopt validator, fill_string_relopt filler, LOCKMODE lockmode) |
void | add_string_reloption (bits32 kinds, const char *name, const char *desc, const char *default_val, validate_string_relopt validator, LOCKMODE lockmode) |
void | add_local_string_reloption (local_relopts *relopts, const char *name, const char *desc, const char *default_val, validate_string_relopt validator, fill_string_relopt filler, int offset) |
Datum | transformRelOptions (Datum oldOptions, List *defList, const char *namspace, const char *const validnsps[], bool acceptOidsOff, bool isReset) |
List * | untransformRelOptions (Datum options) |
bytea * | extractRelOptions (HeapTuple tuple, TupleDesc tupdesc, amoptions_function amoptions) |
static void | parseRelOptionsInternal (Datum options, bool validate, relopt_value *reloptions, int numoptions) |
static relopt_value * | parseRelOptions (Datum options, bool validate, relopt_kind kind, int *numrelopts) |
static relopt_value * | parseLocalRelOptions (local_relopts *relopts, Datum options, bool validate) |
static void * | allocateReloptStruct (Size base, relopt_value *options, int numoptions) |
static void | fillRelOptions (void *rdopts, Size basesize, relopt_value *options, int numoptions, bool validate, const relopt_parse_elt *elems, int numelems) |
bytea * | default_reloptions (Datum reloptions, bool validate, relopt_kind kind) |
void * | build_reloptions (Datum reloptions, bool validate, relopt_kind kind, Size relopt_struct_size, const relopt_parse_elt *relopt_elems, int num_relopt_elems) |
void * | build_local_reloptions (local_relopts *relopts, Datum options, bool validate) |
bytea * | partitioned_table_reloptions (Datum reloptions, bool validate) |
bytea * | view_reloptions (Datum reloptions, bool validate) |
bytea * | heap_reloptions (char relkind, Datum reloptions, bool validate) |
bytea * | index_reloptions (amoptions_function amoptions, Datum reloptions, bool validate) |
bytea * | attribute_reloptions (Datum reloptions, bool validate) |
bytea * | tablespace_reloptions (Datum reloptions, bool validate) |
LOCKMODE | AlterTableGetRelOptionsLockLevel (List *defList) |
Variables | |
static relopt_bool | boolRelOpts [] |
static relopt_int | intRelOpts [] |
static relopt_real | realRelOpts [] |
static relopt_enum_elt_def | StdRdOptIndexCleanupValues [] |
static relopt_enum_elt_def | gistBufferingOptValues [] |
static relopt_enum_elt_def | viewCheckOptValues [] |
static relopt_enum | enumRelOpts [] |
static relopt_string | stringRelOpts [] |
static relopt_gen ** | relOpts = NULL |
static bits32 | last_assigned_kind = RELOPT_KIND_LAST_DEFAULT |
static int | num_custom_options = 0 |
static relopt_gen ** | custom_options = NULL |
static bool | need_initialization = true |
#define GET_STRING_RELOPTION_LEN | ( | option | ) |
Definition at line 588 of file reloptions.c.
void add_bool_reloption | ( | bits32 | kinds, |
const char * | name, | ||
const char * | desc, | ||
bool | default_val, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 868 of file reloptions.c.
References add_reloption(), init_bool_reloption(), and name.
Referenced by create_reloptions_table().
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 | ||
) |
Definition at line 1037 of file reloptions.c.
References add_reloption(), init_enum_reloption(), and name.
Referenced by create_reloptions_table().
void add_int_reloption | ( | bits32 | kinds, |
const char * | name, | ||
const char * | desc, | ||
int | default_val, | ||
int | min_val, | ||
int | max_val, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 920 of file reloptions.c.
References add_reloption(), init_int_reloption(), max_val, and name.
Referenced by _PG_init(), and create_reloptions_table().
void add_local_bool_reloption | ( | local_relopts * | relopts, |
const char * | name, | ||
const char * | desc, | ||
bool | default_val, | ||
int | offset | ||
) |
Definition at line 884 of file reloptions.c.
References add_local_reloption(), init_bool_reloption(), name, and RELOPT_KIND_LOCAL.
void add_local_enum_reloption | ( | local_relopts * | relopts, |
const char * | name, | ||
const char * | desc, | ||
relopt_enum_elt_def * | members, | ||
int | default_val, | ||
const char * | detailmsg, | ||
int | offset | ||
) |
Definition at line 1055 of file reloptions.c.
References add_local_reloption(), init_enum_reloption(), name, and RELOPT_KIND_LOCAL.
void add_local_int_reloption | ( | local_relopts * | relopts, |
const char * | name, | ||
const char * | desc, | ||
int | default_val, | ||
int | min_val, | ||
int | max_val, | ||
int | offset | ||
) |
Definition at line 937 of file reloptions.c.
References add_local_reloption(), init_int_reloption(), max_val, name, and RELOPT_KIND_LOCAL.
Referenced by _ltree_gist_options(), brin_minmax_multi_options(), g_int_options(), g_intbig_options(), ghstore_options(), gtrgm_options(), gtsvector_options(), and ltree_gist_options().
void add_local_real_reloption | ( | local_relopts * | relopts, |
const char * | name, | ||
const char * | desc, | ||
double | default_val, | ||
double | min_val, | ||
double | max_val, | ||
int | offset | ||
) |
Definition at line 991 of file reloptions.c.
References add_local_reloption(), init_real_reloption(), max_val, name, and RELOPT_KIND_LOCAL.
Referenced by brin_bloom_options().
|
static |
Definition at line 776 of file reloptions.c.
References Assert, lappend(), local_relopt::offset, local_relopt::option, local_relopts::options, and palloc().
Referenced by add_local_bool_reloption(), add_local_enum_reloption(), add_local_int_reloption(), add_local_real_reloption(), and add_local_string_reloption().
void add_local_string_reloption | ( | local_relopts * | relopts, |
const char * | name, | ||
const char * | desc, | ||
const char * | default_val, | ||
validate_string_relopt | validator, | ||
fill_string_relopt | filler, | ||
int | offset | ||
) |
Definition at line 1137 of file reloptions.c.
References add_local_reloption(), init_string_reloption(), name, and RELOPT_KIND_LOCAL.
void add_real_reloption | ( | bits32 | kinds, |
const char * | name, | ||
const char * | desc, | ||
double | default_val, | ||
double | min_val, | ||
double | max_val, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 973 of file reloptions.c.
References add_reloption(), init_real_reloption(), max_val, and name.
Referenced by create_reloptions_table().
|
static |
Definition at line 719 of file reloptions.c.
References custom_options, MemoryContextSwitchTo(), need_initialization, num_custom_options, palloc(), repalloc(), and TopMemoryContext.
Referenced by add_bool_reloption(), add_enum_reloption(), add_int_reloption(), add_real_reloption(), and add_string_reloption().
relopt_kind add_reloption_kind | ( | void | ) |
Definition at line 702 of file reloptions.c.
References ereport, errcode(), errmsg(), ERROR, last_assigned_kind, and RELOPT_KIND_MAX.
Referenced by _PG_init(), and create_reloptions_table().
void add_string_reloption | ( | bits32 | kinds, |
const char * | name, | ||
const char * | desc, | ||
const char * | default_val, | ||
validate_string_relopt | validator, | ||
LOCKMODE | lockmode | ||
) |
Definition at line 1117 of file reloptions.c.
References add_reloption(), init_string_reloption(), and name.
Referenced by create_reloptions_table().
|
static |
Definition at line 794 of file reloptions.c.
References relopt_gen::desc, elog, ERROR, relopt_gen::kinds, relopt_gen::lockmode, MemoryContextSwitchTo(), name, relopt_gen::name, relopt_gen::namelen, palloc(), pstrdup(), RELOPT_KIND_LOCAL, RELOPT_TYPE_BOOL, RELOPT_TYPE_ENUM, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, RELOPT_TYPE_STRING, size, TopMemoryContext, type, and relopt_gen::type.
Referenced by init_bool_reloption(), init_enum_reloption(), init_int_reloption(), init_real_reloption(), and init_string_reloption().
|
static |
Definition at line 1721 of file reloptions.c.
References relopt_string::default_isnull, relopt_string::default_val, relopt_string::fill_cb, relopt_value::gen, GET_STRING_RELOPTION_LEN, i, if(), relopt_value::isset, palloc0(), RELOPT_TYPE_STRING, size, relopt_value::string_val, relopt_gen::type, val, and relopt_value::values.
Referenced by build_local_reloptions(), and build_reloptions().
Definition at line 2131 of file reloptions.c.
References AccessExclusiveLock, DefElem::defname, i, initialize_reloptions(), lfirst, relopt_gen::lockmode, name, relopt_gen::namelen, need_initialization, NIL, NoLock, and relOpts.
Referenced by AlterTableGetLockLevel().
Definition at line 2092 of file reloptions.c.
References build_reloptions(), lengthof, RELOPT_KIND_ATTRIBUTE, and RELOPT_TYPE_REAL.
Referenced by ATExecSetOptions(), and get_attribute_options().
void * build_local_reloptions | ( | local_relopts * | relopts, |
Datum | options, | ||
bool | validate | ||
) |
Definition at line 1968 of file reloptions.c.
References allocateReloptStruct(), fillRelOptions(), i, lfirst, list_length(), relopt_gen::name, noptions, relopt_parse_elt::offset, local_relopt::offset, local_relopt::option, local_relopts::options, relopt_parse_elt::optname, opts, relopt_parse_elt::opttype, palloc(), parseLocalRelOptions(), pfree(), local_relopts::relopt_struct_size, relopt_gen::type, and local_relopts::validators.
Referenced by index_opclass_options().
void * build_reloptions | ( | Datum | reloptions, |
bool | validate, | ||
relopt_kind | kind, | ||
Size | relopt_struct_size, | ||
const relopt_parse_elt * | relopt_elems, | ||
int | num_relopt_elems | ||
) |
Definition at line 1931 of file reloptions.c.
References allocateReloptStruct(), Assert, fillRelOptions(), options, parseRelOptions(), and pfree().
Referenced by attribute_reloptions(), bloptions(), brinoptions(), btoptions(), default_reloptions(), dioptions(), ginoptions(), gistoptions(), hashoptions(), spgoptions(), tablespace_reloptions(), and view_reloptions().
bytea * default_reloptions | ( | Datum | reloptions, |
bool | validate, | ||
relopt_kind | kind | ||
) |
Definition at line 1857 of file reloptions.c.
References build_reloptions(), fillfactor, lengthof, RELOPT_TYPE_BOOL, RELOPT_TYPE_ENUM, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, vacuum_cost_delay, vacuum_cost_limit, and vacuum_max_eager_freeze_failure_rate.
Referenced by heap_reloptions().
bytea * extractRelOptions | ( | HeapTuple | tuple, |
TupleDesc | tupdesc, | ||
amoptions_function | amoptions | ||
) |
Definition at line 1398 of file reloptions.c.
References Assert, fastgetattr(), GETSTRUCT(), heap_reloptions(), index_reloptions(), options, partitioned_table_reloptions(), and view_reloptions().
Referenced by extract_autovac_opts(), and RelationParseRelOptions().
|
static |
Definition at line 1761 of file reloptions.c.
References relopt_string::default_isnull, relopt_string::default_val, elog, ERROR, relopt_string::fill_cb, i, j, relopt_parse_elt::offset, relopt_parse_elt::optname, RELOPT_TYPE_BOOL, RELOPT_TYPE_ENUM, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, RELOPT_TYPE_STRING, SET_VARSIZE, size, and values.
Referenced by build_local_reloptions(), and build_reloptions().
Definition at line 2042 of file reloptions.c.
References AutoVacOpts::analyze_scale_factor, AutoVacOpts::analyze_threshold, StdRdOptions::autovacuum, default_reloptions(), StdRdOptions::fillfactor, RELOPT_KIND_HEAP, and RELOPT_KIND_TOAST.
Referenced by ATExecSetRelOptions(), create_ctas_internal(), DefineRelation(), extractRelOptions(), and ProcessUtilitySlow().
bytea * index_reloptions | ( | amoptions_function | amoptions, |
Datum | reloptions, | ||
bool | validate | ||
) |
Definition at line 2077 of file reloptions.c.
References Assert, DatumGetPointer(), and PointerIsValid.
Referenced by ATExecSetRelOptions(), DefineIndex(), and extractRelOptions().
|
static |
Definition at line 851 of file reloptions.c.
References allocate_reloption(), relopt_bool::default_val, name, and RELOPT_TYPE_BOOL.
Referenced by add_bool_reloption(), and add_local_bool_reloption().
|
static |
Definition at line 1008 of file reloptions.c.
References allocate_reloption(), relopt_enum::default_val, relopt_enum::detailmsg, relopt_enum::members, name, and RELOPT_TYPE_ENUM.
Referenced by add_enum_reloption(), and add_local_enum_reloption().
|
static |
Definition at line 900 of file reloptions.c.
References allocate_reloption(), relopt_int::default_val, relopt_int::max, max_val, relopt_int::min, name, and RELOPT_TYPE_INT.
Referenced by add_int_reloption(), and add_local_int_reloption().
void init_local_reloptions | ( | local_relopts * | relopts, |
Size | relopt_struct_size | ||
) |
Definition at line 753 of file reloptions.c.
References NIL, local_relopts::options, local_relopts::relopt_struct_size, and local_relopts::validators.
Referenced by _ltree_gist_options(), brin_bloom_options(), brin_minmax_multi_options(), g_int_options(), g_intbig_options(), ghstore_options(), gtrgm_options(), gtsvector_options(), index_opclass_options(), and ltree_gist_options().
|
static |
Definition at line 953 of file reloptions.c.
References allocate_reloption(), relopt_real::default_val, relopt_real::max, max_val, relopt_real::min, name, and RELOPT_TYPE_REAL.
Referenced by add_local_real_reloption(), and add_real_reloption().
|
static |
Definition at line 1072 of file reloptions.c.
References allocate_reloption(), relopt_string::default_isnull, relopt_string::default_len, relopt_string::default_val, relopt_string::fill_cb, MemoryContextStrdup(), name, RELOPT_KIND_LOCAL, RELOPT_TYPE_STRING, TopMemoryContext, and relopt_string::validate_cb.
Referenced by add_local_string_reloption(), and add_string_reloption().
|
static |
Definition at line 599 of file reloptions.c.
References Assert, boolRelOpts, custom_options, DoLockModesConflict(), enumRelOpts, relopt_bool::gen, relopt_int::gen, relopt_real::gen, relopt_enum::gen, relopt_string::gen, i, intRelOpts, j, relopt_gen::lockmode, MemoryContextAlloc(), name, relopt_gen::name, relopt_gen::namelen, need_initialization, num_custom_options, pfree(), realRelOpts, RELOPT_TYPE_BOOL, RELOPT_TYPE_ENUM, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, RELOPT_TYPE_STRING, relOpts, stringRelOpts, TopMemoryContext, and relopt_gen::type.
Referenced by AlterTableGetRelOptionsLockLevel(), and parseRelOptions().
|
static |
Definition at line 1588 of file reloptions.c.
References _, relopt_enum::default_val, relopt_enum::detailmsg, elog, ereport, errcode(), errdetail(), errdetail_internal(), errmsg(), ERROR, for(), if(), relopt_int::max, relopt_real::max, relopt_enum::members, relopt_int::min, relopt_real::min, option::name, palloc(), parse_bool(), parse_int(), parse_real(), pfree(), pg_strcasecmp(), RELOPT_TYPE_BOOL, RELOPT_TYPE_ENUM, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, RELOPT_TYPE_STRING, relopt_enum_elt_def::string_val, relopt_string::validate_cb, and value.
Referenced by parseRelOptionsInternal().
|
static |
Definition at line 1560 of file reloptions.c.
References i, lfirst, list_length(), local_relopt::option, local_relopts::options, palloc(), parseRelOptionsInternal(), and values.
Referenced by build_local_reloptions().
|
static |
Definition at line 1518 of file reloptions.c.
References DatumGetPointer(), relopt_value::gen, i, initialize_reloptions(), relopt_value::isset, j, need_initialization, palloc(), parseRelOptionsInternal(), PointerIsValid, and relOpts.
Referenced by build_reloptions().
|
static |
Definition at line 1446 of file reloptions.c.
References DatumGetArrayTypeP, DatumGetPointer(), deconstruct_array_builtin(), ereport, errcode(), errmsg(), ERROR, relopt_value::gen, i, j, relopt_gen::namelen, noptions, parse_one_reloption(), pfree(), TextDatumGetCString, VARDATA, VARHDRSZ, and VARSIZE.
Referenced by parseLocalRelOptions(), and parseRelOptions().
Definition at line 2007 of file reloptions.c.
References ereport, errcode(), errhint(), errmsg(), and ERROR.
Referenced by ATExecSetRelOptions(), DefineRelation(), and extractRelOptions().
void register_reloptions_validator | ( | local_relopts * | relopts, |
relopts_validator | validator | ||
) |
Definition at line 766 of file reloptions.c.
References lappend(), and local_relopts::validators.
Referenced by ltree_gist_options().
Definition at line 2109 of file reloptions.c.
References build_reloptions(), effective_io_concurrency, lengthof, maintenance_io_concurrency, random_page_cost, RELOPT_KIND_TABLESPACE, RELOPT_TYPE_INT, RELOPT_TYPE_REAL, and seq_page_cost.
Referenced by AlterTableSpaceOptions(), CreateTableSpace(), and get_tablespace().
Datum transformRelOptions | ( | Datum | oldOptions, |
List * | defList, | ||
const char * | namspace, | ||
const char *const | validnsps[], | ||
bool | acceptOidsOff, | ||
bool | isReset | ||
) |
Definition at line 1175 of file reloptions.c.
References accumArrayResult(), DefElem::arg, CurrentMemoryContext, DatumGetArrayTypeP, DatumGetPointer(), deconstruct_array_builtin(), defGetBoolean(), defGetString(), DefElem::defname, DefElem::defnamespace, ereport, errcode(), errmsg(), ERROR, i, len, lfirst, makeArrayResult(), NIL, palloc(), PointerGetDatum(), PointerIsValid, SET_VARSIZE, sprintf, value, VARDATA, VARHDRSZ, and VARSIZE.
Referenced by AlterTableSpaceOptions(), ATExecSetOptions(), ATExecSetRelOptions(), ComputeIndexAttrs(), create_ctas_internal(), CreateTableSpace(), DefineIndex(), DefineRelation(), and ProcessUtilitySlow().
Definition at line 1350 of file reloptions.c.
References DatumGetArrayTypeP, DatumGetPointer(), deconstruct_array_builtin(), i, lappend(), makeDefElem(), makeString(), NIL, noptions, PointerIsValid, TextDatumGetCString, and val.
Referenced by ATExecSetRelOptions(), dblink_fdw_validator(), file_fdw_validator(), generateClonedIndexStmt(), GetForeignColumnOptions(), GetForeignDataWrapperExtended(), GetForeignServerExtended(), GetForeignTable(), GetUserMapping(), pg_options_to_table(), postgres_fdw_validator(), postgresql_fdw_validator(), and transformGenericOptions().
Definition at line 2021 of file reloptions.c.
References build_reloptions(), lengthof, RELOPT_KIND_VIEW, RELOPT_TYPE_BOOL, and RELOPT_TYPE_ENUM.
Referenced by ATExecSetRelOptions(), DefineRelation(), and extractRelOptions().
|
static |
Definition at line 94 of file reloptions.c.
Referenced by initialize_reloptions().
|
static |
Definition at line 576 of file reloptions.c.
Referenced by add_reloption(), and initialize_reloptions().
|
static |
Definition at line 527 of file reloptions.c.
Referenced by initialize_reloptions().
|
static |
Definition at line 510 of file reloptions.c.
|
static |
Definition at line 173 of file reloptions.c.
Referenced by initialize_reloptions().
|
static |
Definition at line 573 of file reloptions.c.
Referenced by add_reloption_kind().
|
static |
Definition at line 577 of file reloptions.c.
Referenced by add_reloption(), AlterTableGetRelOptionsLockLevel(), initialize_reloptions(), and parseRelOptions().
|
static |
Definition at line 575 of file reloptions.c.
Referenced by add_reloption(), and initialize_reloptions().
|
static |
Definition at line 397 of file reloptions.c.
Referenced by initialize_reloptions().
|
static |
Definition at line 572 of file reloptions.c.
Referenced by AlterTableGetRelOptionsLockLevel(), initialize_reloptions(), and parseRelOptions().
|
static |
Definition at line 495 of file reloptions.c.
|
static |
Definition at line 566 of file reloptions.c.
Referenced by initialize_reloptions().
|
static |
Definition at line 519 of file reloptions.c.