184 stmt->relation->location);
208 errmsg(
"relation \"%s\" already exists, skipping",
209 stmt->relation->relname)));
220 if (
stmt->relation->schemaname ==
NULL
228 cxt.
stmtType =
"CREATE FOREIGN TABLE";
255 if (
stmt->ofTypename)
260 if (
stmt->inhRelations && !
stmt->partbound)
263 errmsg(
"cannot create partitioned table as inheritance child")));
270 foreach(elements,
stmt->tableElts)
289 elog(
ERROR,
"unrecognized node type: %d",
321 if (
strcmp(cd->colname, colname) != 0)
327 cd->is_not_null =
true;
482 (
errmsg_internal(
"%s will create implicit sequence \"%s\" for serial column \"%s.%s\"",
502 errmsg(
"cannot set logged status of a temporary sequence"),
515 seqstmt->for_identity = for_identity;
606 && !
column->typeName->pct_type)
640 errmsg(
"array of serial is not implemented"),
642 column->typeName->location)));
719 switch (constraint->contype)
739 switch (constraint->contype)
745 errmsg(
"conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
748 constraint->location)));
749 column->is_not_null =
false;
757 errmsg(
"not-null constraints on partitioned tables cannot be NO INHERIT"));
763 errmsg(
"conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
766 constraint->location)));
771 errmsg(
"conflicting NO INHERIT declarations for not-null constraints on column \"%s\"",
787 column->is_not_null =
true;
797 if (constraint->conname &&
800 elog(
ERROR,
"conflicting not-null constraint names \"%s\" and \"%s\"",
806 errmsg(
"conflicting NO INHERIT declarations for not-null constraints on column \"%s\"",
819 errmsg(
"multiple default values specified for column \"%s\" of table \"%s\"",
822 constraint->location)));
823 column->raw_default = constraint->raw_expr;
836 errmsg(
"identity columns are not supported on typed tables")));
840 errmsg(
"identity columns are not supported on partitions")));
849 errmsg(
"multiple identity specifications for column \"%s\" of table \"%s\"",
852 constraint->location)));
855 typeOid, constraint->options,
859 column->identity = constraint->generated_when;
868 else if (!
column->is_not_null)
871 errmsg(
"conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
874 constraint->location)));
882 errmsg(
"generated columns are not supported on typed tables")));
886 errmsg(
"multiple generation clauses specified for column \"%s\" of table \"%s\"",
889 constraint->location)));
890 column->generated = constraint->generated_kind;
891 column->raw_default = constraint->raw_expr;
904 errmsg(
"conflicting NULL/NOT NULL declarations for column \"%s\" of table \"%s\"",
907 constraint->location)));
913 errmsg(
"primary key constraints are not supported on foreign tables"),
915 constraint->location)));
922 errmsg(
"unique constraints are not supported on foreign tables"),
924 constraint->location)));
925 if (constraint->keys ==
NIL)
932 elog(
ERROR,
"column exclusion constraints are not supported");
939 errmsg(
"foreign key constraints are not supported on foreign tables"),
941 constraint->location)));
961 elog(
ERROR,
"unrecognized constraint type: %d",
962 constraint->contype);
969 errmsg(
"both default and identity specified for column \"%s\" of table \"%s\"",
972 constraint->location)));
977 errmsg(
"both default and generation expression specified for column \"%s\" of table \"%s\"",
980 constraint->location)));
985 errmsg(
"both identity and generation expression specified for column \"%s\" of table \"%s\"",
988 constraint->location)));
997 column->is_not_null =
true;
1041 errmsg(
"primary key constraints are not supported on foreign tables"),
1051 errmsg(
"unique constraints are not supported on foreign tables"),
1061 errmsg(
"exclusion constraints are not supported on foreign tables"),
1075 errmsg(
"not-null constraints on partitioned tables cannot be NO INHERIT"));
1084 errmsg(
"foreign key constraints are not supported on foreign tables"),
1098 elog(
ERROR,
"invalid context for constraint type %d",
1103 elog(
ERROR,
"unrecognized constraint type: %d",
1147 errmsg(
"relation \"%s\" is invalid in LIKE clause",
1362 elog(
ERROR,
"expandTableLikeClause called on untransformed LIKE clause");
1414 bool found_whole_row;
1418 elog(
ERROR,
"default expression not found for attribute %d of relation \"%s\"",
1435 if (found_whole_row)
1438 errmsg(
"cannot convert whole-row table reference"),
1439 errdetail(
"Generation expression for column \"%s\" contains a whole-row reference to table \"%s\".",
1464 bool found_whole_row;
1479 if (found_whole_row)
1482 errmsg(
"cannot convert whole-row table reference"),
1483 errdetail(
"Constraint \"%s\" contains a whole-row reference to table \"%s\".",
1537 atcmd->missing_ok =
false;
1545 relation->
rd_rel->relhasindex &&
1652 for (
i = 0;
i < tupdesc->
natts;
i++)
1657 if (attr->attisdropped)
1661 attr->atttypmod, attr->attcollation);
1732 elog(
ERROR,
"cache lookup failed for access method %u",
1747 index->relation = heapRel;
1760 index->nulls_not_distinct =
idxrec->indnullsnotdistinct;
1763 index->transformed =
true;
1764 index->concurrent =
false;
1765 index->if_not_exists =
false;
1766 index->reset_default_tblspc =
false;
1797 elog(
ERROR,
"cache lookup failed for constraint %u",
1801 index->isconstraint =
true;
1806 if (
idxrec->indisexclusion)
1813 (
index->iswithoutoverlaps &&
1820 for (
i = 0;
i < nElems;
i++)
1832 elog(
ERROR,
"cache lookup failed for operator %u",
1849 index->isconstraint =
false;
1852 index->isconstraint =
false;
1872 for (keyno = 0; keyno <
idxrec->indnkeyatts; keyno++)
1897 bool found_whole_row;
1900 elog(
ERROR,
"too few entries in indexprs list");
1911 if (found_whole_row)
1914 errmsg(
"cannot convert whole-row table reference"),
1915 errdetail(
"Index \"%s\" contains a whole-row table reference.",
1966 for (keyno =
idxrec->indnkeyatts; keyno <
idxrec->indnatts; keyno++)
1988 errmsg(
"expressions are not supported in included columns")));
2010 bool found_whole_row;
2023 if (found_whole_row)
2026 errmsg(
"cannot convert whole-row table reference"),
2027 errdetail(
"Index \"%s\" contains a whole-row table reference.",
2083 elog(
ERROR,
"stxkind is not a 1-D char array");
2097 elog(
ERROR,
"unrecognized statistics kind %c", enabled[
i]);
2138 bool found_whole_row;
2194 elog(
ERROR,
"cache lookup failed for collation %u", collation);
2221 elog(
ERROR,
"cache lookup failed for opclass %u", opclass);
2286 foreach(
lc, indexlist)
2358 errmsg(
"multiple primary keys for table \"%s\" are not allowed",
2369 index->isconstraint =
true;
2392 index->transformed =
false;
2393 index->concurrent =
false;
2394 index->if_not_exists =
false;
2425 errmsg(
"cannot use an existing index in CREATE TABLE"),
2445 errmsg(
"index \"%s\" is already associated with a constraint",
2453 errmsg(
"index \"%s\" does not belong to table \"%s\"",
2472 errdetail(
"Cannot create a primary key or unique constraint using such an index."),
2479 errdetail(
"Cannot create a primary key or unique constraint using such an index."),
2486 errdetail(
"Cannot create a primary key or unique constraint using such an index."),
2498 errdetail(
"Cannot create a non-deferrable constraint using a deferrable index."),
2557 attoptions != (
Datum) 0 ||
2561 errmsg(
"index \"%s\" column number %d does not have default sorting behavior",
index_name,
i + 1),
2562 errdetail(
"Cannot create a primary key or unique constraint using such an index."),
2614 foreach(
lc, constraint->
keys)
2624 foreach(columns, cxt->
columns)
2658 if (
nn->is_no_inherit)
2661 errmsg(
"conflicting NO INHERIT declaration for not-null constraint on column \"%s\"",
2669 column->is_not_null =
true;
2705 errmsg(
"inherited relation \"%s\" is not a table or foreign table",
2707 for (count = 0; count < rel->
rd_att->
natts; count++)
2741 errmsg(
"column \"%s\" named in key does not exist", key),
2745 foreach(columns,
index->indexParams)
2753 errmsg(
"column \"%s\" appears twice in primary key constraint",
2759 errmsg(
"column \"%s\" appears twice in unique constraint",
2784 if (attr->attisdropped)
2790 typid = attr->atttypid;
2809 errmsg(
"column \"%s\" in WITHOUT OVERLAPS is not a range or multirange type", key),
2838 errmsg(
"constraint using WITHOUT OVERLAPS needs at least two columns"));
2841 index->accessMethod =
"gist";
2861 foreach(columns, cxt->
columns)
2899 errmsg(
"inherited relation \"%s\" is not a table or foreign table",
2901 for (count = 0; count < rel->
rd_att->
natts; count++)
2930 errmsg(
"column \"%s\" named in key does not exist", key),
3070 if (
stmt->transformed)
3091 if (
stmt->whereClause)
3102 foreach(l,
stmt->indexParams)
3136 errmsg(
"index expressions and predicates can refer only to the table being indexed")));
3144 stmt->transformed =
true;
3165 if (
stmt->transformed)
3186 foreach(l,
stmt->exprs)
3208 errmsg(
"statistics expressions can refer only to the table being referenced")));
3216 stmt->transformed =
true;
3233 List **actions,
Node **whereClause)
3251 errmsg(
"rules on materialized views are not supported")));
3278 switch (
stmt->event)
3294 elog(
ERROR,
"unrecognized event type: %d",
3311 errmsg(
"rule WHERE condition cannot contain references to other relations")));
3338 foreach(l,
stmt->actions)
3380 *whereClause !=
NULL)
3383 errmsg(
"rules with WHERE conditions can only have SELECT, INSERT, UPDATE, or DELETE actions")));
3401 errmsg(
"conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
3413 switch (
stmt->event)
3419 errmsg(
"ON SELECT rule cannot use OLD")));
3423 errmsg(
"ON SELECT rule cannot use NEW")));
3432 errmsg(
"ON INSERT rule cannot use OLD")));
3438 errmsg(
"ON DELETE rule cannot use NEW")));
3441 elog(
ERROR,
"unrecognized event type: %d",
3466 errmsg(
"cannot refer to OLD within WITH query")));
3473 errmsg(
"cannot refer to NEW within WITH query")));
3502 errmsg(
"conditional UNION/INTERSECT/EXCEPT statements are not implemented")));
3543 ?
errhint(
"ALTER TABLE ... MERGE PARTITIONS can only merge partitions don't have sub-partitions.")
3544 :
errhint(
"ALTER TABLE ... SPLIT PARTITION can only split partitions don't have sub-partitions."));
3546 if (!partRel->
rd_rel->relispartition)
3549 errmsg(
"\"%s\" is not a partition of partitioned table \"%s\"",
3552 ?
errhint(
"ALTER TABLE ... MERGE PARTITIONS can only merge partitions don't have sub-partitions.")
3553 :
errhint(
"ALTER TABLE ... SPLIT PARTITION can only split partitions don't have sub-partitions."));
3558 errmsg(
"relation \"%s\" is not a partition of relation \"%s\"",
3561 ?
errhint(
"ALTER TABLE ... MERGE PARTITIONS can only merge partitions don't have sub-partitions.")
3562 :
errhint(
"ALTER TABLE ... SPLIT PARTITION can only split partitions don't have sub-partitions."));
3582 int default_index = -1;
3620 if (
sps->bound->is_default)
3622 if (default_index != -1)
3625 errmsg(
"DEFAULT partition should be one"),
3637 errmsg(
"partition of hash-partitioned table cannot be split"));
3641 elog(
ERROR,
"unexpected partition strategy: %d",
3642 (
int) key->strategy);
3652 errmsg(
"can not split DEFAULT partition \"%s\"",
3654 errhint(
"To split DEFAULT partition one of the new partition must be DEFAULT."),
3669 errmsg(
"can not split non-DEFAULT partition \"%s\"",
3671 errmsg(
"new partition cannot be DEFAULT because DEFAULT partition \"%s\" already exists",
3694 errmsg(
"partition with name \"%s\" is already used",
name->relname),
3702 errmsg(
"partition with name \"%s\" is already used",
name->relname),
3738 errmsg(
"partition of hash-partitioned table cannot be merged"));
3755 errmsg(
"partition with name \"%s\" is already used",
name->relname),
3784 errmsg(
"partition with name \"%s\" is already used",
name->relname),
3798 partcmd->bound->strategy = strategy;
3799 partcmd->bound->location = -1;
3821 const char *queryString,
3855 cxt.
stmtType =
"ALTER FOREIGN TABLE";
3925 elog(
ERROR,
"unrecognized node type: %d",
3957 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
3997 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
4039 errmsg(
"column \"%s\" of relation \"%s\" does not exist",
4091 errmsg(
"list of partitions to be merged should include at least two partitions"));
4105 errmsg(
"list of new partitions should contain at least two partitions"));
4142 foreach(l, cxt.
alist)
4224#define SUPPORTS_ATTRS(node) \
4225 ((node) != NULL && \
4226 ((node)->contype == CONSTR_PRIMARY || \
4227 (node)->contype == CONSTR_UNIQUE || \
4228 (node)->contype == CONSTR_EXCLUSION || \
4229 (node)->contype == CONSTR_FOREIGN))
4236 elog(
ERROR,
"unrecognized node type: %d",
4244 errmsg(
"misplaced DEFERRABLE clause"),
4249 errmsg(
"multiple DEFERRABLE/NOT DEFERRABLE clauses not allowed"),
4259 errmsg(
"misplaced NOT DEFERRABLE clause"),
4264 errmsg(
"multiple DEFERRABLE/NOT DEFERRABLE clauses not allowed"),
4272 errmsg(
"constraint declared INITIALLY DEFERRED must be DEFERRABLE"),
4280 errmsg(
"misplaced INITIALLY DEFERRED clause"),
4285 errmsg(
"multiple INITIALLY IMMEDIATE/DEFERRED clauses not allowed"),
4298 errmsg(
"constraint declared INITIALLY DEFERRED must be DEFERRABLE"),
4306 errmsg(
"misplaced INITIALLY IMMEDIATE clause"),
4311 errmsg(
"multiple INITIALLY IMMEDIATE/DEFERRED clauses not allowed"),
4323 errmsg(
"misplaced ENFORCED clause"),
4328 errmsg(
"multiple ENFORCED/NOT ENFORCED clauses not allowed"),
4340 errmsg(
"misplaced NOT ENFORCED clause"),
4345 errmsg(
"multiple ENFORCED/NOT ENFORCED clauses not allowed"),
4384 column->collClause->collname,
4385 column->collClause->location);
4390 errmsg(
"collations are not supported by type %s",
4393 column->collClause->location)));
4440 foreach(
lc, schemaElts)
4562 elog(
ERROR,
"unrecognized node type: %d",
4589 errmsg(
"CREATE specifies a schema (%s) "
4590 "different from the one being created (%s)",
4599 errmsg(
"cannot create temporary relation in non-temporary schema"),
4623 errmsg(
"CREATE specifies a schema (%s) "
4624 "different from the one being created (%s)",
4653 foreach(
lc,
stmt->tableElts)
4813 errmsg(
"\"%s\" is not a partitioned table",
4820 errmsg(
"table \"%s\" is not partitioned",
4827 errmsg(
"index \"%s\" is not partitioned",
4832 elog(
ERROR,
"\"%s\" is not a partitioned table or index",
4856 if (
spec->is_default)
4867 errmsg(
"a hash-partitioned table may not have a default partition")));
4884 errmsg(
"invalid bound specification for a hash partition"),
4887 if (
spec->modulus <= 0)
4890 errmsg(
"modulus for hash partition must be an integer value greater than zero")));
4894 if (
spec->remainder >=
spec->modulus)
4897 errmsg(
"remainder for hash partition must be less than modulus")));
4910 errmsg(
"invalid bound specification for a list partition"),
4914 if (key->partattrs[0] != 0)
4916 key->partattrs[0],
false);
4928 foreach(cell,
spec->listdatums)
4963 errmsg(
"invalid bound specification for a range partition"),
4969 errmsg(
"FROM must specify exactly one value per partitioning column")));
4973 errmsg(
"TO must specify exactly one value per partitioning column")));
4987 elog(
ERROR,
"unexpected partition strategy: %d", (
int) strategy);
5065 if (key->partattrs[
i] != 0)
5067 key->partattrs[
i],
false);
5086 if (
value->constisnull)
5089 errmsg(
"cannot specify NULL in range bound")));
5125 if (kind ==
prd->kind)
5137 errmsg(
"every bound following MAXVALUE must also be MAXVALUE"),
5144 errmsg(
"every bound following MINVALUE must also be MINVALUE"),
5187 errmsg(
"specified value cannot be cast to type %s for column \"%s\"",
5202 elog(
ERROR,
"could not evaluate partition bound expression");
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
Oid get_index_am_oid(const char *amname, bool missing_ok)
#define DatumGetArrayTypeP(X)
void deconstruct_array_builtin(const ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
AttrMap * build_attrmap_by_name(TupleDesc indesc, TupleDesc outdesc, bool missing_ok)
#define AttributeNumberIsValid(attributeNumber)
#define InvalidAttrNumber
char * get_tablespace_name(Oid spc_oid)
#define TextDatumGetCString(d)
#define InvalidSubTransactionId
#define Assert(condition)
#define OidIsValid(objectId)
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
Expr * evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod, Oid result_collation)
List * sequence_options(Oid relid)
void errorConflictingDefElem(DefElem *defel, ParseState *pstate)
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
bool equal(const void *a, const void *b)
const FormData_pg_attribute * SystemAttributeByName(const char *attname)
const FormData_pg_attribute * SystemAttributeDefinition(AttrNumber attno)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
#define DEFAULT_INDEX_TYPE
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid, bool isconstraint)
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
List * lappend(List *list, void *datum)
List * list_concat(List *list1, const List *list2)
List * list_copy(const List *oldlist)
List * lappend_oid(List *list, Oid datum)
List * lcons(void *datum, List *list)
void list_free(List *list)
#define AccessExclusiveLock
char * get_rel_name(Oid relid)
AttrNumber get_attnum(Oid relid, const char *attname)
bool type_is_range(Oid typid)
Datum get_attoptions(Oid relid, int16 attnum)
Oid get_rel_namespace(Oid relid)
Oid get_typcollation(Oid typid)
char * get_attname(Oid relid, AttrNumber attnum, bool missing_ok)
Oid getBaseType(Oid typid)
char * get_namespace_name(Oid nspid)
Oid get_atttype(Oid relid, AttrNumber attnum)
Oid get_relname_relid(const char *relname, Oid relnamespace)
bool type_is_multirange(Oid typid)
Alias * makeAlias(const char *aliasname, List *colnames)
DefElem * makeDefElem(char *name, Node *arg, int location)
FromExpr * makeFromExpr(List *fromlist, Node *quals)
ColumnDef * makeColumnDef(const char *colname, Oid typeOid, int32 typmod, Oid collOid)
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
FuncCall * makeFuncCall(List *name, List *args, CoercionForm funcformat, int location)
Constraint * makeNotNullConstraint(String *colname)
TypeName * makeTypeNameFromOid(Oid typeOid, int32 typmod)
char * pstrdup(const char *in)
void pfree(void *pointer)
Oid RangeVarGetAndCheckCreationNamespace(RangeVar *relation, LOCKMODE lockmode, Oid *existing_relation_id)
void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid)
void DeconstructQualifiedName(const List *names, char **nspname_p, char **objname_p)
Oid RangeVarGetCreationNamespace(const RangeVar *newRelation)
RangeVar * makeRangeVarFromNameList(const List *names)
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
Oid exprType(const Node *expr)
int exprLocation(const Node *expr)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
ObjectType get_relkind_objtype(char relkind)
#define ObjectAddressSet(addr, class_id, object_id)
char * nodeToString(const void *obj)
Node * transformWhereClause(ParseState *pstate, Node *clause, ParseExprKind exprKind, const char *constructName)
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
void assign_expr_collations(ParseState *pstate, Node *expr)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
void cancel_parser_errposition_callback(ParseCallbackState *pcbstate)
void free_parsestate(ParseState *pstate)
int parser_errposition(ParseState *pstate, int location)
void setup_parser_errposition_callback(ParseCallbackState *pcbstate, ParseState *pstate, int location)
ParseState * make_parsestate(ParseState *parentParseState)
@ EXPR_KIND_STATS_EXPRESSION
@ EXPR_KIND_INDEX_EXPRESSION
@ EXPR_KIND_PARTITION_BOUND
@ EXPR_KIND_INDEX_PREDICATE
@ EXPR_KIND_ALTER_COL_TRANSFORM
void addNSItemToQuery(ParseState *pstate, ParseNamespaceItem *nsitem, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace)
ParseNamespaceItem * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, LOCKMODE lockmode, Alias *alias, bool inh, bool inFromCl)
char * FigureIndexColname(Node *node)
Oid LookupCollation(ParseState *pstate, List *collnames, int location)
Type typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p)
Oid typenameTypeId(ParseState *pstate, const TypeName *typeName)
static void generateSerialExtraStmts(CreateStmtContext *cxt, ColumnDef *column, Oid seqtypid, List *seqoptions, bool for_identity, bool col_exists, char **snamespace_p, char **sname_p)
List * transformCreateStmt(CreateStmt *stmt, const char *queryString)
IndexStmt * transformIndexStmt(Oid relid, IndexStmt *stmt, const char *queryString)
List * transformCreateSchemaStmtElements(ParseState *pstate, List *schemaElts, const char *schemaName)
static void transformColumnType(CreateStmtContext *cxt, ColumnDef *column)
static void transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
static CreateStmt * transformCreateSchemaCreateTable(ParseState *pstate, CreateStmt *stmt, List **fk_elements)
void transformRuleStmt(RuleStmt *stmt, const char *queryString, List **actions, Node **whereClause)
static void transformConstraintAttrs(ParseState *pstate, List *constraintList)
static void transformIndexConstraints(CreateStmtContext *cxt)
static List * get_collation(Oid collation, Oid actual_datatype)
static IndexStmt * transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
static void checkSchemaNameRV(ParseState *pstate, const char *context_schema, RangeVar *relation)
AlterTableStmt * transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, const char *queryString, List **beforeStmts, List **afterStmts)
static void transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_clause)
List * expandTableLikeClause(RangeVar *heapRel, TableLikeClause *table_like_clause)
static void transformPartitionCmdForSplit(CreateStmtContext *cxt, PartitionCmd *partcmd)
static void transformTableConstraint(CreateStmtContext *cxt, Constraint *constraint)
static List * get_opclass(Oid opclass, Oid actual_datatype)
static void transformPartitionCmdForMerge(CreateStmtContext *cxt, PartitionCmd *partcmd)
static void checkPartition(Relation rel, Oid partRelOid, bool isMerge)
static List * transformPartitionRangeBounds(ParseState *pstate, List *blist, Relation parent)
CreateStatsStmt * transformStatsStmt(Oid relid, CreateStatsStmt *stmt, const char *queryString)
static void validateInfiniteBounds(ParseState *pstate, List *blist)
static void transformPartitionCmd(CreateStmtContext *cxt, PartitionBoundSpec *bound)
static Const * transformPartitionBoundValue(ParseState *pstate, Node *val, const char *colName, Oid colType, int32 colTypmod, Oid partCollation)
static void transformCheckConstraints(CreateStmtContext *cxt, bool skipValidation)
static void transformOfType(CreateStmtContext *cxt, TypeName *ofTypename)
static CreateStatsStmt * generateClonedExtStatsStmt(RangeVar *heapRel, Oid heapRelid, Oid source_statsid, const AttrMap *attmap)
PartitionBoundSpec * transformPartitionBound(ParseState *pstate, Relation parent, PartitionBoundSpec *spec)
static void transformFKConstraints(CreateStmtContext *cxt, bool skipValidation, bool isAddConstraint)
IndexStmt * generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, const AttrMap *attmap, Oid *constraintOid)
static void checkSchemaNameList(const char *context_schema, List *qualified_name)
#define SUPPORTS_ATTRS(node)
@ PARTITION_STRATEGY_HASH
@ PARTITION_STRATEGY_LIST
@ PARTITION_STRATEGY_RANGE
@ CONSTR_ATTR_NOT_DEFERRABLE
@ CONSTR_ATTR_NOT_ENFORCED
@ PARTITION_RANGE_DATUM_MAXVALUE
@ PARTITION_RANGE_DATUM_VALUE
@ PARTITION_RANGE_DATUM_MINVALUE
@ AT_AlterColumnGenericOptions
@ CREATE_TABLE_LIKE_COMMENTS
@ CREATE_TABLE_LIKE_GENERATED
@ CREATE_TABLE_LIKE_IDENTITY
@ CREATE_TABLE_LIKE_COMPRESSION
@ CREATE_TABLE_LIKE_STORAGE
@ CREATE_TABLE_LIKE_INDEXES
@ CREATE_TABLE_LIKE_DEFAULTS
@ CREATE_TABLE_LIKE_STATISTICS
@ CREATE_TABLE_LIKE_CONSTRAINTS
Query * transformStmt(ParseState *pstate, Node *parseTree)
List * SystemFuncName(char *name)
TypeName * SystemTypeName(char *name)
void check_partitions_for_split(Relation parent, Oid splitPartOid, List *partlist, ParseState *pstate)
void calculate_partition_bound_for_merge(Relation parent, List *partNames, List *partOids, PartitionBoundSpec *spec, ParseState *pstate)
PartitionKey RelationGetPartitionKey(Relation rel)
static int get_partition_strategy(PartitionKey key)
static int32 get_partition_col_typmod(PartitionKey key, int col)
static int get_partition_natts(PartitionKey key)
static Oid get_partition_col_typid(PartitionKey key, int col)
static List * get_partition_exprs(PartitionKey key)
static Oid get_partition_col_collation(PartitionKey key, int col)
PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached)
Oid get_default_oid_from_partdesc(PartitionDesc partdesc)
Oid get_partition_parent(Oid relid, bool even_if_detached)
END_CATALOG_STRUCT typedef FormData_pg_am * Form_pg_am
FormData_pg_attribute * Form_pg_attribute
int errdetail_relkind_not_supported(char relkind)
FormData_pg_class * Form_pg_class
END_CATALOG_STRUCT typedef FormData_pg_collation * Form_pg_collation
List * RelationGetNotNullConstraints(Oid relid, bool cooked, bool include_noinh)
Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok)
END_CATALOG_STRUCT typedef FormData_pg_constraint * Form_pg_constraint
void checkMembershipInCurrentExtension(const ObjectAddress *object)
Oid getIdentitySequence(Relation rel, AttrNumber attnum, bool missing_ok)
Oid get_index_constraint(Oid indexId)
END_CATALOG_STRUCT typedef FormData_pg_index * Form_pg_index
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define linitial_node(type, l)
#define lsecond_node(type, l)
#define foreach_current_index(var_or_cell)
#define foreach_delete_current(lst, var_or_cell)
#define for_each_cell(cell, lst, initcell)
static void * list_nth(const List *list, int n)
#define list_make3(x1, x2, x3)
#define foreach_node(type, var, lst)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
#define list_make2(x1, x2)
static ListCell * list_last_cell(const List *list)
END_CATALOG_STRUCT typedef FormData_pg_opclass * Form_pg_opclass
END_CATALOG_STRUCT typedef FormData_pg_operator * Form_pg_operator
END_CATALOG_STRUCT typedef FormData_pg_statistic_ext * Form_pg_statistic_ext
END_CATALOG_STRUCT typedef FormData_pg_type * Form_pg_type
Expr * expression_planner(Expr *expr)
static Oid DatumGetObjectId(Datum X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
void * stringToNode(const char *str)
static chr element(struct vars *v, const chr *startp, const chr *endp)
#define RelationGetForm(relation)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define RelationGetNamespace(relation)
List * RelationGetIndexList(Relation relation)
List * RelationGetIndexPredicate(Relation relation)
List * RelationGetStatExtList(Relation relation)
List * RelationGetIndexExpressions(Relation relation)
List * untransformRelOptions(Datum options)
#define InvalidRelFileNumber
bool rangeTableEntry_used(Node *node, int rt_index, int sublevels_up)
Query * getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
Node * map_variable_attnos(Node *node, int target_varno, int sublevels_up, const AttrMap *attno_map, Oid to_rowtype, bool *found_whole_row)
char * quote_qualified_identifier(const char *qualifier, const char *ident)
List * deparse_context_for(const char *aliasname, Oid relid)
char * deparse_expression(Node *expr, List *dpcontext, bool forceprefix, bool showimplicit)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_openrv(const RangeVar *relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
bool reset_default_tblspc
PartitionBoundSpec * partbound
const char * p_sourcetext
void ReleaseSysCache(HeapTuple tuple)
Datum SysCacheGetAttrNotNull(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Datum SysCacheGetAttr(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
void check_of_type(HeapTuple typetuple)
void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
const char * GetCompressionMethodName(char method)
#define CompressionMethodIsValid(cm)
Node * TupleDescGetDefault(TupleDesc tupdesc, AttrNumber attnum)
#define ReleaseTupleDesc(tupdesc)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod)
String * makeString(char *str)
bool contain_var_clause(Node *node)