69#include "utils/fmgroids.h"
114 Oid rangeOid,
Oid subtype);
116 Oid multirangeOid,
Oid rangeOid,
117 Oid rangeArrayOid,
Oid *castFuncOid);
156 int16 internalLength = -1;
165 char category = TYPCATEGORY_USER;
166 bool preferred =
false;
169 char *defaultValue = NULL;
170 bool byValue =
false;
171 char alignment = TYPALIGN_INT;
172 char storage = TYPSTORAGE_PLAIN;
175 DefElem *internalLengthEl = NULL;
180 DefElem *typmodinNameEl = NULL;
181 DefElem *typmodoutNameEl = NULL;
183 DefElem *subscriptNameEl = NULL;
188 DefElem *defaultValueEl = NULL;
220 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
221 errmsg(
"must be superuser to create a base type")));
253 errmsg(
"type \"%s\" already exists", typeName)));
260 if (parameters ==
NIL)
265 errmsg(
"type \"%s\" already exists", typeName)));
278 errmsg(
"type \"%s\" does not exist", typeName),
279 errhint(
"Create the type as a shell type, then create its I/O functions, then do a full CREATE TYPE.")));
282 foreach(pl, parameters)
287 if (strcmp(defel->
defname,
"like") == 0)
288 defelp = &likeTypeEl;
289 else if (strcmp(defel->
defname,
"internallength") == 0)
290 defelp = &internalLengthEl;
291 else if (strcmp(defel->
defname,
"input") == 0)
292 defelp = &inputNameEl;
293 else if (strcmp(defel->
defname,
"output") == 0)
294 defelp = &outputNameEl;
295 else if (strcmp(defel->
defname,
"receive") == 0)
296 defelp = &receiveNameEl;
297 else if (strcmp(defel->
defname,
"send") == 0)
298 defelp = &sendNameEl;
299 else if (strcmp(defel->
defname,
"typmod_in") == 0)
300 defelp = &typmodinNameEl;
301 else if (strcmp(defel->
defname,
"typmod_out") == 0)
302 defelp = &typmodoutNameEl;
303 else if (strcmp(defel->
defname,
"analyze") == 0 ||
304 strcmp(defel->
defname,
"analyse") == 0)
305 defelp = &analyzeNameEl;
306 else if (strcmp(defel->
defname,
"subscript") == 0)
307 defelp = &subscriptNameEl;
308 else if (strcmp(defel->
defname,
"category") == 0)
309 defelp = &categoryEl;
310 else if (strcmp(defel->
defname,
"preferred") == 0)
311 defelp = &preferredEl;
312 else if (strcmp(defel->
defname,
"delimiter") == 0)
313 defelp = &delimiterEl;
314 else if (strcmp(defel->
defname,
"element") == 0)
315 defelp = &elemTypeEl;
316 else if (strcmp(defel->
defname,
"default") == 0)
317 defelp = &defaultValueEl;
318 else if (strcmp(defel->
defname,
"passedbyvalue") == 0)
320 else if (strcmp(defel->
defname,
"alignment") == 0)
321 defelp = &alignmentEl;
322 else if (strcmp(defel->
defname,
"storage") == 0)
324 else if (strcmp(defel->
defname,
"collatable") == 0)
325 defelp = &collatableEl;
330 (
errcode(ERRCODE_SYNTAX_ERROR),
331 errmsg(
"type attribute \"%s\" not recognized",
353 internalLength = likeForm->typlen;
354 byValue = likeForm->typbyval;
355 alignment = likeForm->typalign;
356 storage = likeForm->typstorage;
359 if (internalLengthEl)
383 if (category < 32 || category > 126)
385 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
386 errmsg(
"invalid type category \"%s\": must be simple ASCII",
404 (
errcode(ERRCODE_DATATYPE_MISMATCH),
405 errmsg(
"array element type cannot be %s",
424 alignment = TYPALIGN_DOUBLE;
427 alignment = TYPALIGN_INT;
430 alignment = TYPALIGN_SHORT;
433 alignment = TYPALIGN_CHAR;
436 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
437 errmsg(
"alignment \"%s\" not recognized",
a)));
453 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
454 errmsg(
"storage \"%s\" not recognized",
a)));
462 if (inputName ==
NIL)
464 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
465 errmsg(
"type input function must be specified")));
466 if (outputName ==
NIL)
468 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
469 errmsg(
"type output function must be specified")));
471 if (typmodinName ==
NIL && typmodoutName !=
NIL)
473 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
474 errmsg(
"type modifier output function is useless without a type modifier input function")));
511 if (internalLength > 0 && !byValue &&
get_typlen(elemType) > 0)
512 subscriptOid = F_RAW_ARRAY_SUBSCRIPT_HANDLER;
515 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
516 errmsg(
"element type cannot be specified without a subscripting function")));
613 alignment = (alignment == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
633 F_ARRAY_SUBSCRIPT_HANDLER,
666 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
700 char *domainArrayName;
703 int16 internalLength;
706 Oid receiveProcedure;
708 Oid analyzeProcedure;
717 char *defaultValue = NULL;
718 char *defaultValueBin = NULL;
719 bool saw_default =
false;
720 bool typNotNull =
false;
721 bool nullDefined =
false;
758 errmsg(
"type \"%s\" already exists", domainName)));
766 basetypeoid = baseType->oid;
776 typtype = baseType->typtype;
777 if (typtype != TYPTYPE_BASE &&
778 typtype != TYPTYPE_COMPOSITE &&
779 typtype != TYPTYPE_DOMAIN &&
780 typtype != TYPTYPE_ENUM &&
781 typtype != TYPTYPE_RANGE &&
782 typtype != TYPTYPE_MULTIRANGE)
784 (
errcode(ERRCODE_DATATYPE_MISMATCH),
785 errmsg(
"\"%s\" is not a valid base type for a domain",
802 baseColl = baseType->typcollation;
803 if (
stmt->collClause)
806 domaincoll = baseColl;
811 (
errcode(ERRCODE_DATATYPE_MISMATCH),
812 errmsg(
"collations are not supported by type %s",
817 byValue = baseType->typbyval;
820 alignment = baseType->typalign;
823 storage = baseType->typstorage;
826 internalLength = baseType->typlen;
829 category = baseType->typcategory;
832 delimiter = baseType->typdelim;
835 inputProcedure = F_DOMAIN_IN;
836 outputProcedure = baseType->typoutput;
837 receiveProcedure = F_DOMAIN_RECV;
838 sendProcedure = baseType->typsend;
843 analyzeProcedure = baseType->typanalyze;
853 Anum_pg_type_typdefault, &isnull);
859 Anum_pg_type_typdefaultbin, &isnull);
867 foreach(listptr, schema)
872 elog(
ERROR,
"unrecognized node type: %d",
885 errmsg(
"multiple default expressions"),
913 if (defaultExpr == NULL ||
915 ((
Const *) defaultExpr)->constisnull))
918 defaultValueBin = NULL;
937 defaultValueBin = NULL;
947 errmsg(
"conflicting NULL/NOT NULL constraints"),
951 errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
952 errmsg(
"redundant NOT NULL constraint definition"),
957 errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
958 errmsg(
"not-null constraints for domains cannot be marked NO INHERIT"),
965 if (nullDefined && typNotNull)
968 errmsg(
"conflicting NULL/NOT NULL constraints"),
984 errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
985 errmsg(
"check constraints for domains cannot be marked NO INHERIT"),
996 errmsg(
"unique constraints not possible for domains"),
1002 (
errcode(ERRCODE_SYNTAX_ERROR),
1003 errmsg(
"primary key constraints not possible for domains"),
1009 (
errcode(ERRCODE_SYNTAX_ERROR),
1010 errmsg(
"exclusion constraints not possible for domains"),
1016 (
errcode(ERRCODE_SYNTAX_ERROR),
1017 errmsg(
"foreign key constraints not possible for domains"),
1026 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1027 errmsg(
"specifying constraint deferrability not supported for domains"),
1034 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1035 errmsg(
"specifying GENERATED not supported for domains"),
1042 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1043 errmsg(
"specifying constraint enforceability not supported for domains"),
1097 alignment = (alignment == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
1117 F_ARRAY_SUBSCRIPT_HANDLER,
1126 TYPSTORAGE_EXTENDED,
1132 pfree(domainArrayName);
1137 foreach(listptr, schema)
1147 basetypeoid, basetypeMod,
1148 constr, domainName, NULL);
1153 basetypeoid, basetypeMod,
1154 constr, domainName, NULL);
1184 char *enumArrayName;
1213 errmsg(
"type \"%s\" already exists", enumName)));
1280 F_ARRAY_SUBSCRIPT_HANDLER,
1289 TYPSTORAGE_EXTENDED,
1295 pfree(enumArrayName);
1297 return enumTypeAddr;
1318 elog(
ERROR,
"cache lookup failed for type %u", enum_type_oid);
1334 stmt->newValNeighbor,
stmt->newValIsAfter,
1335 stmt->skipIfNewValExists);
1358 if (typTup->typtype != TYPTYPE_ENUM)
1360 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1361 errmsg(
"%s is not an enum",
1385 char *rangeArrayName;
1386 char *multirangeTypeName = NULL;
1387 char *multirangeArrayName;
1391 Oid multirangeArrayOid;
1393 List *rangeSubOpclassName =
NIL;
1394 List *rangeCollationName =
NIL;
1395 List *rangeCanonicalName =
NIL;
1396 List *rangeSubtypeDiffName =
NIL;
1397 Oid rangeSubOpclass;
1439 errmsg(
"type \"%s\" already exists", typeName)));
1448 foreach(lc,
stmt->params)
1452 if (strcmp(defel->
defname,
"subtype") == 0)
1459 else if (strcmp(defel->
defname,
"subtype_opclass") == 0)
1461 if (rangeSubOpclassName !=
NIL)
1465 else if (strcmp(defel->
defname,
"collation") == 0)
1467 if (rangeCollationName !=
NIL)
1471 else if (strcmp(defel->
defname,
"canonical") == 0)
1473 if (rangeCanonicalName !=
NIL)
1477 else if (strcmp(defel->
defname,
"subtype_diff") == 0)
1479 if (rangeSubtypeDiffName !=
NIL)
1483 else if (strcmp(defel->
defname,
"multirange_type_name") == 0)
1485 if (multirangeTypeName != NULL)
1489 &multirangeTypeName);
1493 (
errcode(ERRCODE_SYNTAX_ERROR),
1494 errmsg(
"type attribute \"%s\" not recognized",
1501 (
errcode(ERRCODE_SYNTAX_ERROR),
1502 errmsg(
"type attribute \"subtype\" is required")));
1506 (
errcode(ERRCODE_DATATYPE_MISMATCH),
1507 errmsg(
"range subtype cannot be %s",
1516 if (rangeCollationName !=
NIL)
1523 if (rangeCollationName !=
NIL)
1525 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1526 errmsg(
"range collation specified but subtype does not support collation")));
1531 if (rangeCanonicalName !=
NIL)
1535 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1536 errmsg(
"cannot specify a canonical function without a pre-created shell type"),
1537 errhint(
"Create the type as a shell type, then create its canonicalization function, then do a full CREATE TYPE.")));
1544 if (rangeSubtypeDiffName !=
NIL)
1551 &subtyplen, &subtypbyval, &subtypalign);
1554 alignment = (subtypalign == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
1590 TYPSTORAGE_EXTENDED,
1599 if (multirangeTypeName)
1619 errmsg(
"type \"%s\" already exists", multirangeTypeName)));
1625 multirangeNamespace = typeNamespace;
1632 multirangeNamespace,
1647 F_MULTIRANGE_TYPANALYZE,
1662 Assert(multirangeOid == mltrngaddress.objectId);
1665 RangeCreate(typoid, rangeSubtype, rangeCollation, rangeSubOpclass,
1666 rangeCanonical, rangeSubtypeDiff, multirangeOid);
1691 F_ARRAY_SUBSCRIPT_HANDLER,
1700 TYPSTORAGE_EXTENDED,
1706 pfree(rangeArrayName);
1713 multirangeArrayName,
1714 multirangeNamespace,
1730 F_ARRAY_SUBSCRIPT_HANDLER,
1748 multirangeOid, typoid, rangeArrayOid,
1753 COERCION_CODE_EXPLICIT, COERCION_METHOD_FUNCTION,
1756 pfree(multirangeArrayName);
1772 Oid rangeOid,
Oid subtype)
1774 static const char *
const prosrc[2] = {
"range_constructor2",
1775 "range_constructor3"};
1776 static const int pronargs[2] = {2, 3};
1778 Oid constructorArgTypes[3];
1783 constructorArgTypes[0] = subtype;
1784 constructorArgTypes[1] = subtype;
1785 constructorArgTypes[2] = TEXTOID;
1787 referenced.
classId = TypeRelationId;
1803 BOOTSTRAP_SUPERUSERID,
1805 F_FMGR_INTERNAL_VALIDATOR,
1813 PROVOLATILE_IMMUTABLE,
1815 constructorArgTypesVector,
1847 Oid multirangeOid,
Oid rangeOid,
Oid rangeArrayOid,
1853 Datum allParamTypes;
1858 referenced.
classId = TypeRelationId;
1859 referenced.
objectId = multirangeOid;
1869 BOOTSTRAP_SUPERUSERID,
1871 F_FMGR_INTERNAL_VALIDATOR,
1872 "multirange_constructor0",
1879 PROVOLATILE_IMMUTABLE,
1914 BOOTSTRAP_SUPERUSERID,
1916 F_FMGR_INTERNAL_VALIDATOR,
1917 "multirange_constructor1",
1924 PROVOLATILE_IMMUTABLE,
1953 BOOTSTRAP_SUPERUSERID,
1955 F_FMGR_INTERNAL_VALIDATOR,
1956 "multirange_constructor2",
1963 PROVOLATILE_IMMUTABLE,
1979 pfree(allParameterTypes);
1980 pfree(parameterModes);
2002 argList[0] = CSTRINGOID;
2003 argList[1] = OIDOID;
2004 argList[2] = INT4OID;
2012 (
errcode(ERRCODE_AMBIGUOUS_FUNCTION),
2013 errmsg(
"type input function %s has multiple matches",
2022 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2023 errmsg(
"function %s does not exist",
2030 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2031 errmsg(
"type input function %s must return type %s",
2046 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2047 errmsg(
"type input function %s should not be volatile",
2063 argList[0] = typeOid;
2068 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2069 errmsg(
"function %s does not exist",
2074 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2075 errmsg(
"type output function %s must return type %s",
2081 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2082 errmsg(
"type output function %s should not be volatile",
2100 argList[0] = INTERNALOID;
2101 argList[1] = OIDOID;
2102 argList[2] = INT4OID;
2110 (
errcode(ERRCODE_AMBIGUOUS_FUNCTION),
2111 errmsg(
"type receive function %s has multiple matches",
2120 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2121 errmsg(
"function %s does not exist",
2128 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2129 errmsg(
"type receive function %s must return type %s",
2135 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2136 errmsg(
"type receive function %s should not be volatile",
2152 argList[0] = typeOid;
2157 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2158 errmsg(
"function %s does not exist",
2163 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2164 errmsg(
"type send function %s must return type %s",
2170 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2171 errmsg(
"type send function %s should not be volatile",
2186 argList[0] = CSTRINGARRAYOID;
2191 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2192 errmsg(
"function %s does not exist",
2197 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2198 errmsg(
"typmod_in function %s must return type %s",
2204 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2205 errmsg(
"type modifier input function %s should not be volatile",
2220 argList[0] = INT4OID;
2225 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2226 errmsg(
"function %s does not exist",
2231 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2232 errmsg(
"typmod_out function %s must return type %s",
2238 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2239 errmsg(
"type modifier output function %s should not be volatile",
2254 argList[0] = INTERNALOID;
2259 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2260 errmsg(
"function %s does not exist",
2265 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2266 errmsg(
"type analyze function %s must return type %s",
2283 argList[0] = INTERNALOID;
2288 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2289 errmsg(
"function %s does not exist",
2294 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2295 errmsg(
"type subscripting function %s must return type %s",
2302 if (procOid == F_ARRAY_SUBSCRIPT_HANDLER)
2304 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2305 errmsg(
"user-defined types cannot use subscripting function %s",
2336 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2337 errmsg(
"operator class \"%s\" does not accept data type %s",
2348 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2349 errmsg(
"data type %s has no default operator class for access method \"%s\"",
2351 errhint(
"You must specify an operator class for the range type or define a default operator class for the subtype.")));
2369 argList[0] = typeOid;
2375 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2376 errmsg(
"function %s does not exist",
2381 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2382 errmsg(
"range canonical function %s must return range type",
2387 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2388 errmsg(
"range canonical function %s must be immutable",
2410 argList[0] = subtype;
2411 argList[1] = subtype;
2417 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2418 errmsg(
"function %s does not exist",
2423 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2424 errmsg(
"range subtype diff function %s must return type %s",
2426 "double precision")));
2430 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2431 errmsg(
"range subtype diff function %s must be immutable",
2457 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2458 errmsg(
"pg_type array OID value not set when in binary upgrade mode")));
2472 return type_array_oid;
2483 Oid type_multirange_oid;
2490 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2491 errmsg(
"pg_type multirange OID value not set when in binary upgrade mode")));
2505 return type_multirange_oid;
2516 Oid type_multirange_array_oid;
2523 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2524 errmsg(
"pg_type multirange array OID value not set when in binary upgrade mode")));
2538 return type_multirange_array_oid;
2622 Node *defaultExpr = NULL;
2623 Datum new_record[Natts_pg_type] = {0};
2624 bool new_record_nulls[Natts_pg_type] = {0};
2625 bool new_record_repl[Natts_pg_type] = {0};
2639 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2658 typTup->typbasetype,
2668 if (defaultExpr == NULL ||
2669 (
IsA(defaultExpr,
Const) && ((
Const *) defaultExpr)->constisnull))
2673 new_record_nulls[Anum_pg_type_typdefaultbin - 1] =
true;
2674 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2675 new_record_nulls[Anum_pg_type_typdefault - 1] =
true;
2676 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2693 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2695 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2701 new_record_nulls[Anum_pg_type_typdefaultbin - 1] =
true;
2702 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2703 new_record_nulls[Anum_pg_type_typdefault - 1] =
true;
2704 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2708 new_record, new_record_nulls,
2761 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2768 if (typTup->typnotnull == notNull)
2784 typTup->typbasetype, typTup->typtypmod,
2785 constr,
NameStr(typTup->typname), NULL);
2796 elog(
ERROR,
"could not find not-null constraint on domain \"%s\"",
NameStr(typTup->typname));
2806 typTup->typnotnull = notNull;
2852 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2862 Anum_pg_constraint_conrelid,
2866 Anum_pg_constraint_contypid,
2870 Anum_pg_constraint_conname,
2883 if (construct->contype == CONSTRAINT_NOTNULL)
2889 conobj.
classId = ConstraintRelationId;
2905 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2906 errmsg(
"constraint \"%s\" of domain \"%s\" does not exist",
2910 (
errmsg(
"constraint \"%s\" of domain \"%s\" does not exist, skipping",
2956 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2963 elog(
ERROR,
"unrecognized node type: %d",
2964 (
int)
nodeTag(newConstraint));
2979 typTup->typbasetype, typTup->typtypmod,
2980 constr,
NameStr(typTup->typname), constrAddr);
3002 if (typTup->typnotnull)
3008 typTup->typbasetype, typTup->typtypmod,
3009 constr,
NameStr(typTup->typname), constrAddr);
3014 typTup->typnotnull =
true;
3058 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
3069 Anum_pg_constraint_conrelid,
3073 Anum_pg_constraint_contypid,
3077 Anum_pg_constraint_conname,
3087 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3088 errmsg(
"constraint \"%s\" of domain \"%s\" does not exist",
3092 if (con->contype != CONSTRAINT_CHECK)
3094 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3095 errmsg(
"constraint \"%s\" of domain \"%s\" is not a check constraint",
3113 copy_con->convalidated =
true;
3179 (
errcode(ERRCODE_NOT_NULL_VIOLATION),
3180 errmsg(
"column \"%s\" of table \"%s\" contains null values",
3273 (
errcode(ERRCODE_CHECK_VIOLATION),
3274 errmsg(
"column \"%s\" of table \"%s\" contains values that violate the new constraint",
3347 Anum_pg_depend_refclassid,
3351 Anum_pg_depend_refobjid,
3367 if (pg_depend->classid == TypeRelationId)
3369 if (
get_typtype(pg_depend->objid) == TYPTYPE_DOMAIN)
3397 if (pg_depend->classid != RelationRelationId ||
3398 pg_depend->objsubid <= 0)
3402 foreach(rellist, result)
3438 if (rel->
rd_rel->relkind != RELKIND_RELATION &&
3439 rel->
rd_rel->relkind != RELKIND_MATVIEW)
3450 result =
lappend(result, rtc);
3462 if (pg_att->attisdropped || pg_att->atttypid != domainOid)
3473 while (ptr > 0 && rtc->
atts[ptr - 1] > pg_depend->objsubid)
3475 rtc->
atts[ptr] = rtc->
atts[ptr - 1];
3478 rtc->
atts[ptr] = pg_depend->objsubid;
3500 if (typTup->typtype != TYPTYPE_DOMAIN)
3502 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3503 errmsg(
"%s is not a domain",
3537 errmsg(
"constraint \"%s\" for domain \"%s\" already exists",
3538 constr->
conname, domainName)));
3560 domVal->
typeId = baseTypeOid;
3561 domVal->typeMod = typMod;
3587 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3588 errmsg(
"cannot use table references in domain check constraint")));
3658 colname =
strVal(field1);
3659 if (strcmp(colname,
"value") == 0)
3665 return (
Node *) domVal;
3693 errmsg(
"constraint \"%s\" for domain \"%s\" already exists",
3694 constr->
conname, domainName)));
3753 const char *newTypeName =
stmt->newname;
3770 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3780 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3781 errmsg(
"%s is not a domain",
3789 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3792 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3793 errmsg(
"%s is a table's row type",
3800 if (IsTrueArrayType(typTup))
3802 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3803 errmsg(
"cannot alter array type %s",
3805 errhint(
"You can alter type %s, which will alter the array type as well.",
3814 if (typTup->typtype == TYPTYPE_COMPOSITE)
3818 typTup->typnamespace);
3851 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3852 errmsg(
"type \"%s\" does not exist",
3863 if (objecttype ==
OBJECT_DOMAIN && typTup->typtype != TYPTYPE_DOMAIN)
3865 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3866 errmsg(
"%s is not a domain",
3874 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3877 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3878 errmsg(
"%s is a table's row type",
3885 if (IsTrueArrayType(typTup))
3887 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3888 errmsg(
"cannot alter array type %s",
3890 errhint(
"You can alter type %s, which will alter the array type as well.",
3894 if (typTup->typtype == TYPTYPE_MULTIRANGE)
3900 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3901 errmsg(
"cannot alter multirange type %s",
3904 errhint(
"You can alter type %s, which will alter the multirange type as well.",
3912 if (typTup->typowner != newOwnerId)
3925 aclresult =
object_aclcheck(NamespaceRelationId, typTup->typnamespace,
3966 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3974 if (typTup->typtype == TYPTYPE_COMPOSITE)
4001 Datum repl_val[Natts_pg_type];
4002 bool repl_null[Natts_pg_type];
4003 bool repl_repl[Natts_pg_type];
4012 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
4015 memset(repl_null,
false,
sizeof(repl_null));
4016 memset(repl_repl,
false,
sizeof(repl_repl));
4018 repl_repl[Anum_pg_type_typowner - 1] =
true;
4022 Anum_pg_type_typacl,
4029 typTup->typowner, newOwnerId);
4030 repl_repl[Anum_pg_type_typacl - 1] =
true;
4044 if (typTup->typtype == TYPTYPE_RANGE)
4050 (
errcode(ERRCODE_UNDEFINED_OBJECT),
4051 errmsg(
"could not find multirange type for data type %s",
4081 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4082 errmsg(
"%s is not a domain",
4093 *oldschema = oldNspOid;
4126 if (ignoreDependent)
4129 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4130 errmsg(
"cannot alter array type %s",
4132 errhint(
"You can alter type %s, which will alter the array type as well.",
4166 bool isImplicitArray,
4167 bool ignoreDependent,
4168 bool errorOnTableType,
4182 thisobj.
classId = TypeRelationId;
4193 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
4196 oldNspOid = typform->typnamespace;
4197 arrayOid = typform->typarray;
4200 if (oldNspOid != nspOid)
4211 errmsg(
"type \"%s\" already exists in schema \"%s\"",
4218 (typform->typtype == TYPTYPE_COMPOSITE &&
4224 if (ignoreDependent)
4229 if (errorOnTableType)
4231 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4232 errmsg(
"%s is a table's row type",
4235 errhint(
"Use %s instead.",
"ALTER TABLE")));
4238 if (oldNspOid != nspOid)
4243 typform->typnamespace = nspOid;
4271 nspOid,
false, objsMoved);
4276 if (typform->typtype == TYPTYPE_DOMAIN)
4285 if (oldNspOid != nspOid &&
4289 NamespaceRelationId, oldNspOid, nspOid) != 1)
4290 elog(
ERROR,
"could not change schema dependency for type \"%s\"",
4329 bool requireSuper =
false;
4343 memset(&atparams, 0,
sizeof(atparams));
4344 foreach(pl,
stmt->options)
4348 if (strcmp(defel->
defname,
"storage") == 0)
4353 atparams.
storage = TYPSTORAGE_PLAIN;
4355 atparams.
storage = TYPSTORAGE_EXTERNAL;
4357 atparams.
storage = TYPSTORAGE_EXTENDED;
4359 atparams.
storage = TYPSTORAGE_MAIN;
4362 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4363 errmsg(
"storage \"%s\" not recognized",
a)));
4369 if (atparams.
storage != TYPSTORAGE_PLAIN && typForm->typlen != -1)
4371 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4372 errmsg(
"fixed-size types must have storage PLAIN")));
4384 if (atparams.
storage != TYPSTORAGE_PLAIN &&
4385 typForm->typstorage == TYPSTORAGE_PLAIN)
4386 requireSuper =
true;
4387 else if (atparams.
storage == TYPSTORAGE_PLAIN &&
4388 typForm->typstorage != TYPSTORAGE_PLAIN)
4390 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4391 errmsg(
"cannot change type's storage to PLAIN")));
4395 else if (strcmp(defel->
defname,
"receive") == 0)
4397 if (defel->
arg != NULL)
4405 requireSuper =
true;
4407 else if (strcmp(defel->
defname,
"send") == 0)
4409 if (defel->
arg != NULL)
4417 requireSuper =
true;
4419 else if (strcmp(defel->
defname,
"typmod_in") == 0)
4421 if (defel->
arg != NULL)
4428 requireSuper =
true;
4430 else if (strcmp(defel->
defname,
"typmod_out") == 0)
4432 if (defel->
arg != NULL)
4439 requireSuper =
true;
4441 else if (strcmp(defel->
defname,
"analyze") == 0)
4443 if (defel->
arg != NULL)
4451 requireSuper =
true;
4453 else if (strcmp(defel->
defname,
"subscript") == 0)
4455 if (defel->
arg != NULL)
4463 requireSuper =
true;
4470 else if (strcmp(defel->
defname,
"input") == 0 ||
4471 strcmp(defel->
defname,
"output") == 0 ||
4472 strcmp(defel->
defname,
"internallength") == 0 ||
4473 strcmp(defel->
defname,
"passedbyvalue") == 0 ||
4474 strcmp(defel->
defname,
"alignment") == 0 ||
4475 strcmp(defel->
defname,
"like") == 0 ||
4476 strcmp(defel->
defname,
"category") == 0 ||
4477 strcmp(defel->
defname,
"preferred") == 0 ||
4478 strcmp(defel->
defname,
"default") == 0 ||
4479 strcmp(defel->
defname,
"element") == 0 ||
4480 strcmp(defel->
defname,
"delimiter") == 0 ||
4481 strcmp(defel->
defname,
"collatable") == 0)
4483 (
errcode(ERRCODE_SYNTAX_ERROR),
4484 errmsg(
"type attribute \"%s\" cannot be changed",
4488 (
errcode(ERRCODE_SYNTAX_ERROR),
4489 errmsg(
"type attribute \"%s\" not recognized",
4501 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
4502 errmsg(
"must be superuser to alter a type")));
4520 if (typForm->typtype != TYPTYPE_BASE)
4522 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4523 errmsg(
"%s is not a base type",
4529 if (IsTrueArrayType(typForm))
4531 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4532 errmsg(
"%s is not a base type",
4577 bool nulls[Natts_pg_type];
4578 bool replaces[Natts_pg_type];
4589 memset(nulls, 0,
sizeof(nulls));
4590 memset(replaces, 0,
sizeof(replaces));
4594 replaces[Anum_pg_type_typstorage - 1] =
true;
4599 replaces[Anum_pg_type_typreceive - 1] =
true;
4604 replaces[Anum_pg_type_typsend - 1] =
true;
4609 replaces[Anum_pg_type_typmodin - 1] =
true;
4614 replaces[Anum_pg_type_typmodout - 1] =
true;
4619 replaces[Anum_pg_type_typanalyze - 1] =
true;
4624 replaces[Anum_pg_type_typsubscript - 1] =
true;
4629 values, nulls, replaces);
4651 if (!isImplicitArray &&
4663 elog(
ERROR,
"cache lookup failed for type %u", arrtypoid);
4665 memset(&arrparams, 0,
sizeof(arrparams));
4694 Anum_pg_type_typbasetype,
4709 if (domainForm->typtype != TYPTYPE_DOMAIN)
Acl * aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId)
void check_can_set_role(Oid member, Oid role)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
void aclcheck_error_type(AclResult aclerr, Oid typeOid)
ArrayType * construct_array_builtin(Datum *elems, int nelems, Oid elmtype)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define TextDatumGetCString(d)
#define PG_USED_FOR_ASSERTS_ONLY
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
TypeName * defGetTypeName(DefElem *def)
int defGetTypeLength(DefElem *def)
char * defGetString(DefElem *def)
bool defGetBoolean(DefElem *def)
List * defGetQualifiedName(DefElem *def)
void errorConflictingDefElem(DefElem *defel, ParseState *pstate)
void performDeletion(const ObjectAddress *object, DropBehavior behavior, int flags)
bool object_address_present(const ObjectAddress *object, const ObjectAddresses *addrs)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
ObjectAddresses * new_object_addresses(void)
void free_object_addresses(ObjectAddresses *addrs)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
ExprState * ExecPrepareExpr(Expr *node, EState *estate)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
void FreeExecutorState(EState *estate)
EState * CreateExecutorState(void)
#define GetPerTupleExprContext(estate)
#define ResetExprContext(econtext)
static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
Assert(PointerIsAligned(start, uint64))
Node * cookDefault(ParseState *pstate, Node *raw_default, Oid atttypid, int32 atttypmod, const char *attname, char attgenerated)
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
HeapTuple heap_copytuple(HeapTuple tuple)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static void * GETSTRUCT(const HeapTupleData *tuple)
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
void CatalogTupleDelete(Relation heapRel, ItemPointer tid)
void CacheInvalidateHeapTuple(Relation relation, HeapTuple tuple, HeapTuple newtuple)
List * lappend(List *list, void *datum)
List * list_concat(List *list1, const List *list2)
#define AccessExclusiveLock
#define ShareUpdateExclusiveLock
Oid get_element_type(Oid typid)
Oid get_opclass_input_type(Oid opclass)
Oid get_multirange_range(Oid multirangeOid)
bool get_typisdefined(Oid typid)
void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)
char get_rel_relkind(Oid relid)
Oid get_typcollation(Oid typid)
char func_volatile(Oid funcid)
char * get_func_name(Oid funcid)
Oid get_range_multirange(Oid rangeOid)
bool type_is_collatable(Oid typid)
int16 get_typlen(Oid typid)
char get_typtype(Oid typid)
char * get_namespace_name(Oid nspid)
Oid get_array_type(Oid typid)
Oid get_func_rettype(Oid funcid)
TypeName * makeTypeNameFromNameList(List *names)
void pfree(void *pointer)
Oid RangeVarGetAndCheckCreationNamespace(RangeVar *relation, LOCKMODE lockmode, Oid *existing_relation_id)
char * NameListToString(const List *names)
Oid QualifiedNameGetCreationNamespace(const List *names, char **objname_p)
Oid LookupCreationNamespace(const char *nspname)
void RangeVarAdjustRelationPersistence(RangeVar *newRelation, Oid nspid)
Oid get_collation_oid(List *collname, bool missing_ok)
void CheckSetNamespace(Oid oldNspOid, Oid nspOid)
#define IsA(nodeptr, _type_)
#define castNode(_type_, nodeptr)
#define InvokeObjectPostAlterHook(classId, objectId, subId)
const ObjectAddress InvalidObjectAddress
#define ObjectAddressSet(addr, class_id, object_id)
oidvector * buildoidvector(const Oid *oids, int n)
Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
char * nodeToString(const void *obj)
bool IsBinaryCoercible(Oid srctype, Oid targettype)
Node * coerce_to_boolean(ParseState *pstate, Node *node, const char *constructName)
void assign_expr_collations(ParseState *pstate, Node *expr)
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
const char * func_signature_string(List *funcname, int nargs, List *argnames, const Oid *argtypes)
Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes, bool missing_ok)
static bool isCompositeType(Oid typid)
int parser_errposition(ParseState *pstate, int location)
ParseState * make_parsestate(ParseState *parentParseState)
char * TypeNameToString(const TypeName *typeName)
Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool missing_ok)
Type typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p)
Oid typenameTypeId(ParseState *pstate, const TypeName *typeName)
@ CONSTR_ATTR_NOT_DEFERRABLE
@ CONSTR_ATTR_NOT_ENFORCED
FormData_pg_attribute * Form_pg_attribute
ObjectAddress CastCreate(Oid sourcetypeid, Oid targettypeid, Oid funcid, Oid incastid, Oid outcastid, char castcontext, char castmethod, DependencyType behavior)
Oid CreateConstraintEntry(const char *constraintName, Oid constraintNamespace, char constraintType, bool isDeferrable, bool isDeferred, bool isEnforced, bool isValidated, Oid parentConstrId, Oid relId, const int16 *constraintKey, int constraintNKeys, int constraintNTotalKeys, Oid domainId, Oid indexRelId, Oid foreignRelId, const int16 *foreignKey, const Oid *pfEqOp, const Oid *ppEqOp, const Oid *ffEqOp, int foreignNKeys, char foreignUpdateType, char foreignDeleteType, const int16 *fkDeleteSetCols, int numFkDeleteSetCols, char foreignMatchType, const Oid *exclOp, Node *conExpr, const char *conBin, bool conIsLocal, int16 conInhCount, bool conNoInherit, bool conPeriod, bool is_internal)
bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, const char *conname)
HeapTuple findDomainNotNullConstraint(Oid typid)
void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, Oid newNspId, bool isType, ObjectAddresses *objsMoved)
char * ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others)
FormData_pg_constraint * Form_pg_constraint
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
long changeDependencyFor(Oid classId, Oid objectId, Oid refClassId, Oid oldRefObjectId, Oid newRefObjectId)
FormData_pg_depend * Form_pg_depend
void RenameEnumLabel(Oid enumTypeOid, const char *oldVal, const char *newVal)
void EnumValuesDelete(Oid enumTypeOid)
void AddEnumLabel(Oid enumTypeOid, const char *newVal, const char *neighbor, bool newValIsAfter, bool skipIfExists)
void EnumValuesCreate(Oid enumTypeOid, List *vals)
static int list_length(const List *l)
ObjectAddress ProcedureCreate(const char *procedureName, Oid procNamespace, bool replace, bool returnsSet, Oid returnType, Oid proowner, Oid languageObjectId, Oid languageValidator, const char *prosrc, const char *probin, Node *prosqlbody, char prokind, bool security_definer, bool isLeakProof, bool isStrict, char volatility, char parallel, oidvector *parameterTypes, Datum allParameterTypes, Datum parameterModes, Datum parameterNames, List *parameterDefaults, Datum trftypes, List *trfoids, Datum proconfig, Oid prosupport, float4 procost, float4 prorows)
void RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation, Oid rangeSubOpclass, RegProcedure rangeCanonical, RegProcedure rangeSubDiff, Oid multirangeTypeOid)
void RangeDelete(Oid rangeTypeOid)
void changeDependencyOnOwner(Oid classId, Oid objectId, Oid newOwnerId)
void GenerateTypeDependencies(HeapTuple typeTuple, Relation typeCatalog, Node *defaultExpr, void *typacl, char relationKind, bool isImplicitArray, bool isDependentType, bool makeExtensionDep, bool rebuild)
void RenameTypeInternal(Oid typeOid, const char *newTypeName, Oid typeNamespace)
ObjectAddress TypeCreate(Oid newTypeOid, const char *typeName, Oid typeNamespace, Oid relationOid, char relationKind, Oid ownerId, int16 internalSize, char typeType, char typeCategory, bool typePreferred, char typDelim, Oid inputProcedure, Oid outputProcedure, Oid receiveProcedure, Oid sendProcedure, Oid typmodinProcedure, Oid typmodoutProcedure, Oid analyzeProcedure, Oid subscriptProcedure, Oid elementType, bool isImplicitArray, Oid arrayType, Oid baseType, const char *defaultTypeValue, char *defaultTypeBin, bool passedByValue, char alignment, char storage, int32 typeMod, int32 typNDims, bool typeNotNull, Oid typeCollation)
bool moveArrayTypeName(Oid typeOid, const char *typeName, Oid typeNamespace)
ObjectAddress TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
char * makeMultirangeTypeName(const char *rangeTypeName, Oid typeNamespace)
char * makeArrayTypeName(const char *typeName, Oid typeNamespace)
FormData_pg_type * Form_pg_type
int pg_strcasecmp(const char *s1, const char *s2)
static bool DatumGetBool(Datum X)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Datum NameGetDatum(const NameData *X)
static Datum CStringGetDatum(const char *X)
static Datum CharGetDatum(char X)
void * stringToNode(const char *str)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
int errtablecol(Relation rel, int attnum)
char * deparse_expression(Node *expr, List *dpcontext, bool forceprefix, bool showimplicit)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Snapshot GetLatestSnapshot(void)
void UnregisterSnapshot(Snapshot snapshot)
Snapshot RegisterSnapshot(Snapshot snapshot)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
void check_stack_depth(void)
#define BTEqualStrategyNumber
#define ERRCODE_DUPLICATE_OBJECT
PreParseColumnRefHook p_pre_columnref_hook
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
#define SearchSysCacheCopy1(cacheId, key1)
#define SearchSysCacheExists2(cacheId, key1, key2)
#define GetSysCacheOid2(cacheId, oidcol, key1, key2)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
TupleTableSlot * table_slot_create(Relation relation, List **reglist)
static void table_endscan(TableScanDesc scan)
static bool table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
static TableScanDesc table_beginscan(Relation rel, Snapshot snapshot, int nkeys, ScanKeyData *key)
void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, bool hasDependEntry, ObjectAddresses *objsMoved)
void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lockmode)
void find_composite_type_dependencies(Oid typeOid, Relation origRelation, const char *origTypeName)
ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString)
void RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal, bool is_index)
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
static Datum slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
static bool slot_attisnull(TupleTableSlot *slot, int attnum)
ObjectAddress AlterDomainNotNull(List *names, bool notNull)
static Oid findTypeReceiveFunction(List *procname, Oid typeOid)
Oid AssignTypeMultirangeOid(void)
Oid binary_upgrade_next_mrng_array_pg_type_oid
static void AlterTypeRecurse(Oid typeOid, bool isImplicitArray, HeapTuple tup, Relation catalog, AlterTypeRecurseParams *atparams)
static void checkEnumOwner(HeapTuple tup)
static Oid findTypeAnalyzeFunction(List *procname, Oid typeOid)
static Oid findRangeSubOpclass(List *opcname, Oid subtype)
Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, bool ignoreDependent, ObjectAddresses *objsMoved)
Oid binary_upgrade_next_mrng_pg_type_oid
ObjectAddress DefineType(ParseState *pstate, List *names, List *parameters)
static Oid findRangeSubtypeDiffFunction(List *procname, Oid subtype)
static Oid findTypeOutputFunction(List *procname, Oid typeOid)
ObjectAddress DefineEnum(CreateEnumStmt *stmt)
static void makeMultirangeConstructors(const char *name, Oid namespace, Oid multirangeOid, Oid rangeOid, Oid rangeArrayOid, Oid *castFuncOid)
static Oid findTypeSendFunction(List *procname, Oid typeOid)
static char * domainAddCheckConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, int typMod, Constraint *constr, const char *domainName, ObjectAddress *constrAddr)
ObjectAddress AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype)
static Oid findRangeCanonicalFunction(List *procname, Oid typeOid)
ObjectAddress AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior behavior, bool missing_ok)
void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId)
ObjectAddress AlterEnum(AlterEnumStmt *stmt)
ObjectAddress AlterDomainAddConstraint(List *names, Node *newConstraint, ObjectAddress *constrAddr)
void RemoveTypeById(Oid typeOid)
ObjectAddress DefineDomain(ParseState *pstate, CreateDomainStmt *stmt)
ObjectAddress AlterDomainValidateConstraint(List *names, const char *constrName)
static Oid findTypeSubscriptingFunction(List *procname, Oid typeOid)
static Oid findTypeTypmodoutFunction(List *procname)
static Oid findTypeTypmodinFunction(List *procname)
ObjectAddress AlterDomainDefault(List *names, Node *defaultRaw)
Oid binary_upgrade_next_array_pg_type_oid
ObjectAddress RenameType(RenameStmt *stmt)
Oid AssignTypeArrayOid(void)
static Oid findTypeInputFunction(List *procname, Oid typeOid)
void checkDomainOwner(HeapTuple tup)
void AlterTypeOwner_oid(Oid typeOid, Oid newOwnerId, bool hasDependEntry)
static void makeRangeConstructors(const char *name, Oid namespace, Oid rangeOid, Oid subtype)
ObjectAddress AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype, Oid *oldschema)
static List * get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
ObjectAddress DefineCompositeType(RangeVar *typevar, List *coldeflist)
static void domainAddNotNullConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, int typMod, Constraint *constr, const char *domainName, ObjectAddress *constrAddr)
Oid AssignTypeMultirangeArrayOid(void)
ObjectAddress AlterType(AlterTypeStmt *stmt)
Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, bool isImplicitArray, bool ignoreDependent, bool errorOnTableType, ObjectAddresses *objsMoved)
static void validateDomainNotNullConstraint(Oid domainoid)
ObjectAddress DefineRange(ParseState *pstate, CreateRangeStmt *stmt)
static void validateDomainCheckConstraint(Oid domainoid, const char *ccbin, LOCKMODE lockmode)
static Node * replace_domain_constraint_value(ParseState *pstate, ColumnRef *cref)
bool contain_var_clause(Node *node)
void CommandCounterIncrement(void)