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;
942 if (nullDefined && !typNotNull)
945 errmsg(
"conflicting NULL/NOT NULL constraints"),
949 errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
950 errmsg(
"not-null constraints for domains cannot be marked NO INHERIT"),
957 if (nullDefined && typNotNull)
960 errmsg(
"conflicting NULL/NOT NULL constraints"),
976 errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
977 errmsg(
"check constraints for domains cannot be marked NO INHERIT"),
988 errmsg(
"unique constraints not possible for domains"),
994 (
errcode(ERRCODE_SYNTAX_ERROR),
995 errmsg(
"primary key constraints not possible for domains"),
1001 (
errcode(ERRCODE_SYNTAX_ERROR),
1002 errmsg(
"exclusion constraints not possible for domains"),
1008 (
errcode(ERRCODE_SYNTAX_ERROR),
1009 errmsg(
"foreign key constraints not possible for domains"),
1018 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1019 errmsg(
"specifying constraint deferrability not supported for domains"),
1026 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1027 errmsg(
"specifying GENERATED not supported for domains"),
1034 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1035 errmsg(
"specifying constraint enforceability not supported for domains"),
1089 alignment = (alignment == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
1109 F_ARRAY_SUBSCRIPT_HANDLER,
1118 TYPSTORAGE_EXTENDED,
1124 pfree(domainArrayName);
1129 foreach(listptr, schema)
1139 basetypeoid, basetypeMod,
1140 constr, domainName, NULL);
1145 basetypeoid, basetypeMod,
1146 constr, domainName, NULL);
1176 char *enumArrayName;
1205 errmsg(
"type \"%s\" already exists", enumName)));
1272 F_ARRAY_SUBSCRIPT_HANDLER,
1281 TYPSTORAGE_EXTENDED,
1287 pfree(enumArrayName);
1289 return enumTypeAddr;
1310 elog(
ERROR,
"cache lookup failed for type %u", enum_type_oid);
1326 stmt->newValNeighbor,
stmt->newValIsAfter,
1327 stmt->skipIfNewValExists);
1350 if (typTup->typtype != TYPTYPE_ENUM)
1352 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1353 errmsg(
"%s is not an enum",
1377 char *rangeArrayName;
1378 char *multirangeTypeName = NULL;
1379 char *multirangeArrayName;
1383 Oid multirangeArrayOid;
1385 List *rangeSubOpclassName =
NIL;
1386 List *rangeCollationName =
NIL;
1387 List *rangeCanonicalName =
NIL;
1388 List *rangeSubtypeDiffName =
NIL;
1389 Oid rangeSubOpclass;
1431 errmsg(
"type \"%s\" already exists", typeName)));
1440 foreach(lc,
stmt->params)
1444 if (strcmp(defel->
defname,
"subtype") == 0)
1451 else if (strcmp(defel->
defname,
"subtype_opclass") == 0)
1453 if (rangeSubOpclassName !=
NIL)
1457 else if (strcmp(defel->
defname,
"collation") == 0)
1459 if (rangeCollationName !=
NIL)
1463 else if (strcmp(defel->
defname,
"canonical") == 0)
1465 if (rangeCanonicalName !=
NIL)
1469 else if (strcmp(defel->
defname,
"subtype_diff") == 0)
1471 if (rangeSubtypeDiffName !=
NIL)
1475 else if (strcmp(defel->
defname,
"multirange_type_name") == 0)
1477 if (multirangeTypeName != NULL)
1481 &multirangeTypeName);
1485 (
errcode(ERRCODE_SYNTAX_ERROR),
1486 errmsg(
"type attribute \"%s\" not recognized",
1493 (
errcode(ERRCODE_SYNTAX_ERROR),
1494 errmsg(
"type attribute \"subtype\" is required")));
1498 (
errcode(ERRCODE_DATATYPE_MISMATCH),
1499 errmsg(
"range subtype cannot be %s",
1508 if (rangeCollationName !=
NIL)
1515 if (rangeCollationName !=
NIL)
1517 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1518 errmsg(
"range collation specified but subtype does not support collation")));
1523 if (rangeCanonicalName !=
NIL)
1527 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1528 errmsg(
"cannot specify a canonical function without a pre-created shell type"),
1529 errhint(
"Create the type as a shell type, then create its canonicalization function, then do a full CREATE TYPE.")));
1536 if (rangeSubtypeDiffName !=
NIL)
1543 &subtyplen, &subtypbyval, &subtypalign);
1546 alignment = (subtypalign == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
1582 TYPSTORAGE_EXTENDED,
1591 if (multirangeTypeName)
1611 errmsg(
"type \"%s\" already exists", multirangeTypeName)));
1617 multirangeNamespace = typeNamespace;
1624 multirangeNamespace,
1639 F_MULTIRANGE_TYPANALYZE,
1654 Assert(multirangeOid == mltrngaddress.objectId);
1657 RangeCreate(typoid, rangeSubtype, rangeCollation, rangeSubOpclass,
1658 rangeCanonical, rangeSubtypeDiff, multirangeOid);
1683 F_ARRAY_SUBSCRIPT_HANDLER,
1692 TYPSTORAGE_EXTENDED,
1698 pfree(rangeArrayName);
1705 multirangeArrayName,
1706 multirangeNamespace,
1722 F_ARRAY_SUBSCRIPT_HANDLER,
1740 multirangeOid, typoid, rangeArrayOid,
1745 COERCION_CODE_EXPLICIT, COERCION_METHOD_FUNCTION,
1748 pfree(multirangeArrayName);
1764 Oid rangeOid,
Oid subtype)
1766 static const char *
const prosrc[2] = {
"range_constructor2",
1767 "range_constructor3"};
1768 static const int pronargs[2] = {2, 3};
1770 Oid constructorArgTypes[3];
1775 constructorArgTypes[0] = subtype;
1776 constructorArgTypes[1] = subtype;
1777 constructorArgTypes[2] = TEXTOID;
1779 referenced.
classId = TypeRelationId;
1795 BOOTSTRAP_SUPERUSERID,
1797 F_FMGR_INTERNAL_VALIDATOR,
1805 PROVOLATILE_IMMUTABLE,
1807 constructorArgTypesVector,
1839 Oid multirangeOid,
Oid rangeOid,
Oid rangeArrayOid,
1845 Datum allParamTypes;
1850 referenced.
classId = TypeRelationId;
1851 referenced.
objectId = multirangeOid;
1861 BOOTSTRAP_SUPERUSERID,
1863 F_FMGR_INTERNAL_VALIDATOR,
1864 "multirange_constructor0",
1871 PROVOLATILE_IMMUTABLE,
1906 BOOTSTRAP_SUPERUSERID,
1908 F_FMGR_INTERNAL_VALIDATOR,
1909 "multirange_constructor1",
1916 PROVOLATILE_IMMUTABLE,
1945 BOOTSTRAP_SUPERUSERID,
1947 F_FMGR_INTERNAL_VALIDATOR,
1948 "multirange_constructor2",
1955 PROVOLATILE_IMMUTABLE,
1971 pfree(allParameterTypes);
1972 pfree(parameterModes);
1994 argList[0] = CSTRINGOID;
1995 argList[1] = OIDOID;
1996 argList[2] = INT4OID;
2004 (
errcode(ERRCODE_AMBIGUOUS_FUNCTION),
2005 errmsg(
"type input function %s has multiple matches",
2014 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2015 errmsg(
"function %s does not exist",
2022 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2023 errmsg(
"type input function %s must return type %s",
2038 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2039 errmsg(
"type input function %s should not be volatile",
2055 argList[0] = typeOid;
2060 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2061 errmsg(
"function %s does not exist",
2066 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2067 errmsg(
"type output function %s must return type %s",
2073 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2074 errmsg(
"type output function %s should not be volatile",
2092 argList[0] = INTERNALOID;
2093 argList[1] = OIDOID;
2094 argList[2] = INT4OID;
2102 (
errcode(ERRCODE_AMBIGUOUS_FUNCTION),
2103 errmsg(
"type receive function %s has multiple matches",
2112 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2113 errmsg(
"function %s does not exist",
2120 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2121 errmsg(
"type receive function %s must return type %s",
2127 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2128 errmsg(
"type receive function %s should not be volatile",
2144 argList[0] = typeOid;
2149 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2150 errmsg(
"function %s does not exist",
2155 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2156 errmsg(
"type send function %s must return type %s",
2162 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2163 errmsg(
"type send function %s should not be volatile",
2178 argList[0] = CSTRINGARRAYOID;
2183 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2184 errmsg(
"function %s does not exist",
2189 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2190 errmsg(
"typmod_in function %s must return type %s",
2196 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2197 errmsg(
"type modifier input function %s should not be volatile",
2212 argList[0] = INT4OID;
2217 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2218 errmsg(
"function %s does not exist",
2223 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2224 errmsg(
"typmod_out function %s must return type %s",
2230 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2231 errmsg(
"type modifier output function %s should not be volatile",
2246 argList[0] = INTERNALOID;
2251 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2252 errmsg(
"function %s does not exist",
2257 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2258 errmsg(
"type analyze function %s must return type %s",
2275 argList[0] = INTERNALOID;
2280 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2281 errmsg(
"function %s does not exist",
2286 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2287 errmsg(
"type subscripting function %s must return type %s",
2294 if (procOid == F_ARRAY_SUBSCRIPT_HANDLER)
2296 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2297 errmsg(
"user-defined types cannot use subscripting function %s",
2328 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2329 errmsg(
"operator class \"%s\" does not accept data type %s",
2340 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2341 errmsg(
"data type %s has no default operator class for access method \"%s\"",
2343 errhint(
"You must specify an operator class for the range type or define a default operator class for the subtype.")));
2361 argList[0] = typeOid;
2367 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2368 errmsg(
"function %s does not exist",
2373 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2374 errmsg(
"range canonical function %s must return range type",
2379 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2380 errmsg(
"range canonical function %s must be immutable",
2402 argList[0] = subtype;
2403 argList[1] = subtype;
2409 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2410 errmsg(
"function %s does not exist",
2415 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2416 errmsg(
"range subtype diff function %s must return type %s",
2418 "double precision")));
2422 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2423 errmsg(
"range subtype diff function %s must be immutable",
2449 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2450 errmsg(
"pg_type array OID value not set when in binary upgrade mode")));
2464 return type_array_oid;
2475 Oid type_multirange_oid;
2482 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2483 errmsg(
"pg_type multirange OID value not set when in binary upgrade mode")));
2497 return type_multirange_oid;
2508 Oid type_multirange_array_oid;
2515 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2516 errmsg(
"pg_type multirange array OID value not set when in binary upgrade mode")));
2530 return type_multirange_array_oid;
2614 Node *defaultExpr = NULL;
2615 Datum new_record[Natts_pg_type] = {0};
2616 bool new_record_nulls[Natts_pg_type] = {0};
2617 bool new_record_repl[Natts_pg_type] = {0};
2631 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2650 typTup->typbasetype,
2660 if (defaultExpr == NULL ||
2661 (
IsA(defaultExpr,
Const) && ((
Const *) defaultExpr)->constisnull))
2665 new_record_nulls[Anum_pg_type_typdefaultbin - 1] =
true;
2666 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2667 new_record_nulls[Anum_pg_type_typdefault - 1] =
true;
2668 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2685 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2687 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2693 new_record_nulls[Anum_pg_type_typdefaultbin - 1] =
true;
2694 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2695 new_record_nulls[Anum_pg_type_typdefault - 1] =
true;
2696 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2700 new_record, new_record_nulls,
2753 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2760 if (typTup->typnotnull == notNull)
2776 typTup->typbasetype, typTup->typtypmod,
2777 constr,
NameStr(typTup->typname), NULL);
2788 elog(
ERROR,
"could not find not-null constraint on domain \"%s\"",
NameStr(typTup->typname));
2798 typTup->typnotnull = notNull;
2844 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2854 Anum_pg_constraint_conrelid,
2858 Anum_pg_constraint_contypid,
2862 Anum_pg_constraint_conname,
2875 if (construct->contype == CONSTRAINT_NOTNULL)
2881 conobj.
classId = ConstraintRelationId;
2897 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2898 errmsg(
"constraint \"%s\" of domain \"%s\" does not exist",
2902 (
errmsg(
"constraint \"%s\" of domain \"%s\" does not exist, skipping",
2948 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2955 elog(
ERROR,
"unrecognized node type: %d",
2956 (
int)
nodeTag(newConstraint));
2971 typTup->typbasetype, typTup->typtypmod,
2972 constr,
NameStr(typTup->typname), constrAddr);
2994 if (typTup->typnotnull)
3000 typTup->typbasetype, typTup->typtypmod,
3001 constr,
NameStr(typTup->typname), constrAddr);
3006 typTup->typnotnull =
true;
3050 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
3061 Anum_pg_constraint_conrelid,
3065 Anum_pg_constraint_contypid,
3069 Anum_pg_constraint_conname,
3079 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3080 errmsg(
"constraint \"%s\" of domain \"%s\" does not exist",
3084 if (con->contype != CONSTRAINT_CHECK)
3086 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3087 errmsg(
"constraint \"%s\" of domain \"%s\" is not a check constraint",
3100 copy_con->convalidated =
true;
3166 (
errcode(ERRCODE_NOT_NULL_VIOLATION),
3167 errmsg(
"column \"%s\" of table \"%s\" contains null values",
3255 (
errcode(ERRCODE_CHECK_VIOLATION),
3256 errmsg(
"column \"%s\" of table \"%s\" contains values that violate the new constraint",
3329 Anum_pg_depend_refclassid,
3333 Anum_pg_depend_refobjid,
3349 if (pg_depend->classid == TypeRelationId)
3351 if (
get_typtype(pg_depend->objid) == TYPTYPE_DOMAIN)
3379 if (pg_depend->classid != RelationRelationId ||
3380 pg_depend->objsubid <= 0)
3384 foreach(rellist, result)
3420 if (rel->
rd_rel->relkind != RELKIND_RELATION &&
3421 rel->
rd_rel->relkind != RELKIND_MATVIEW)
3432 result =
lappend(result, rtc);
3444 if (pg_att->attisdropped || pg_att->atttypid != domainOid)
3455 while (ptr > 0 && rtc->
atts[ptr - 1] > pg_depend->objsubid)
3457 rtc->
atts[ptr] = rtc->
atts[ptr - 1];
3460 rtc->
atts[ptr] = pg_depend->objsubid;
3482 if (typTup->typtype != TYPTYPE_DOMAIN)
3484 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3485 errmsg(
"%s is not a domain",
3519 errmsg(
"constraint \"%s\" for domain \"%s\" already exists",
3520 constr->
conname, domainName)));
3542 domVal->
typeId = baseTypeOid;
3543 domVal->typeMod = typMod;
3569 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3570 errmsg(
"cannot use table references in domain check constraint")));
3640 colname =
strVal(field1);
3641 if (strcmp(colname,
"value") == 0)
3647 return (
Node *) domVal;
3675 errmsg(
"constraint \"%s\" for domain \"%s\" already exists",
3676 constr->
conname, domainName)));
3735 const char *newTypeName =
stmt->newname;
3752 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3762 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3763 errmsg(
"%s is not a domain",
3771 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3774 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3775 errmsg(
"%s is a table's row type",
3782 if (IsTrueArrayType(typTup))
3784 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3785 errmsg(
"cannot alter array type %s",
3787 errhint(
"You can alter type %s, which will alter the array type as well.",
3796 if (typTup->typtype == TYPTYPE_COMPOSITE)
3800 typTup->typnamespace);
3833 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3834 errmsg(
"type \"%s\" does not exist",
3845 if (objecttype ==
OBJECT_DOMAIN && typTup->typtype != TYPTYPE_DOMAIN)
3847 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3848 errmsg(
"%s is not a domain",
3856 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3859 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3860 errmsg(
"%s is a table's row type",
3867 if (IsTrueArrayType(typTup))
3869 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3870 errmsg(
"cannot alter array type %s",
3872 errhint(
"You can alter type %s, which will alter the array type as well.",
3876 if (typTup->typtype == TYPTYPE_MULTIRANGE)
3882 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3883 errmsg(
"cannot alter multirange type %s",
3886 errhint(
"You can alter type %s, which will alter the multirange type as well.",
3894 if (typTup->typowner != newOwnerId)
3907 aclresult =
object_aclcheck(NamespaceRelationId, typTup->typnamespace,
3948 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3956 if (typTup->typtype == TYPTYPE_COMPOSITE)
3983 Datum repl_val[Natts_pg_type];
3984 bool repl_null[Natts_pg_type];
3985 bool repl_repl[Natts_pg_type];
3994 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3997 memset(repl_null,
false,
sizeof(repl_null));
3998 memset(repl_repl,
false,
sizeof(repl_repl));
4000 repl_repl[Anum_pg_type_typowner - 1] =
true;
4004 Anum_pg_type_typacl,
4011 typTup->typowner, newOwnerId);
4012 repl_repl[Anum_pg_type_typacl - 1] =
true;
4026 if (typTup->typtype == TYPTYPE_RANGE)
4032 (
errcode(ERRCODE_UNDEFINED_OBJECT),
4033 errmsg(
"could not find multirange type for data type %s",
4063 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4064 errmsg(
"%s is not a domain",
4075 *oldschema = oldNspOid;
4108 if (ignoreDependent)
4111 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4112 errmsg(
"cannot alter array type %s",
4114 errhint(
"You can alter type %s, which will alter the array type as well.",
4148 bool isImplicitArray,
4149 bool ignoreDependent,
4150 bool errorOnTableType,
4164 thisobj.
classId = TypeRelationId;
4175 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
4178 oldNspOid = typform->typnamespace;
4179 arrayOid = typform->typarray;
4182 if (oldNspOid != nspOid)
4193 errmsg(
"type \"%s\" already exists in schema \"%s\"",
4200 (typform->typtype == TYPTYPE_COMPOSITE &&
4206 if (ignoreDependent)
4211 if (errorOnTableType)
4213 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4214 errmsg(
"%s is a table's row type",
4217 errhint(
"Use %s instead.",
"ALTER TABLE")));
4220 if (oldNspOid != nspOid)
4225 typform->typnamespace = nspOid;
4253 nspOid,
false, objsMoved);
4258 if (typform->typtype == TYPTYPE_DOMAIN)
4267 if (oldNspOid != nspOid &&
4271 NamespaceRelationId, oldNspOid, nspOid) != 1)
4272 elog(
ERROR,
"could not change schema dependency for type \"%s\"",
4311 bool requireSuper =
false;
4325 memset(&atparams, 0,
sizeof(atparams));
4326 foreach(pl,
stmt->options)
4330 if (strcmp(defel->
defname,
"storage") == 0)
4335 atparams.
storage = TYPSTORAGE_PLAIN;
4337 atparams.
storage = TYPSTORAGE_EXTERNAL;
4339 atparams.
storage = TYPSTORAGE_EXTENDED;
4341 atparams.
storage = TYPSTORAGE_MAIN;
4344 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4345 errmsg(
"storage \"%s\" not recognized",
a)));
4351 if (atparams.
storage != TYPSTORAGE_PLAIN && typForm->typlen != -1)
4353 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4354 errmsg(
"fixed-size types must have storage PLAIN")));
4366 if (atparams.
storage != TYPSTORAGE_PLAIN &&
4367 typForm->typstorage == TYPSTORAGE_PLAIN)
4368 requireSuper =
true;
4369 else if (atparams.
storage == TYPSTORAGE_PLAIN &&
4370 typForm->typstorage != TYPSTORAGE_PLAIN)
4372 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4373 errmsg(
"cannot change type's storage to PLAIN")));
4377 else if (strcmp(defel->
defname,
"receive") == 0)
4379 if (defel->
arg != NULL)
4387 requireSuper =
true;
4389 else if (strcmp(defel->
defname,
"send") == 0)
4391 if (defel->
arg != NULL)
4399 requireSuper =
true;
4401 else if (strcmp(defel->
defname,
"typmod_in") == 0)
4403 if (defel->
arg != NULL)
4410 requireSuper =
true;
4412 else if (strcmp(defel->
defname,
"typmod_out") == 0)
4414 if (defel->
arg != NULL)
4421 requireSuper =
true;
4423 else if (strcmp(defel->
defname,
"analyze") == 0)
4425 if (defel->
arg != NULL)
4433 requireSuper =
true;
4435 else if (strcmp(defel->
defname,
"subscript") == 0)
4437 if (defel->
arg != NULL)
4445 requireSuper =
true;
4452 else if (strcmp(defel->
defname,
"input") == 0 ||
4453 strcmp(defel->
defname,
"output") == 0 ||
4454 strcmp(defel->
defname,
"internallength") == 0 ||
4455 strcmp(defel->
defname,
"passedbyvalue") == 0 ||
4456 strcmp(defel->
defname,
"alignment") == 0 ||
4457 strcmp(defel->
defname,
"like") == 0 ||
4458 strcmp(defel->
defname,
"category") == 0 ||
4459 strcmp(defel->
defname,
"preferred") == 0 ||
4460 strcmp(defel->
defname,
"default") == 0 ||
4461 strcmp(defel->
defname,
"element") == 0 ||
4462 strcmp(defel->
defname,
"delimiter") == 0 ||
4463 strcmp(defel->
defname,
"collatable") == 0)
4465 (
errcode(ERRCODE_SYNTAX_ERROR),
4466 errmsg(
"type attribute \"%s\" cannot be changed",
4470 (
errcode(ERRCODE_SYNTAX_ERROR),
4471 errmsg(
"type attribute \"%s\" not recognized",
4483 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
4484 errmsg(
"must be superuser to alter a type")));
4502 if (typForm->typtype != TYPTYPE_BASE)
4504 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4505 errmsg(
"%s is not a base type",
4511 if (IsTrueArrayType(typForm))
4513 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4514 errmsg(
"%s is not a base type",
4559 bool nulls[Natts_pg_type];
4560 bool replaces[Natts_pg_type];
4571 memset(nulls, 0,
sizeof(nulls));
4572 memset(replaces, 0,
sizeof(replaces));
4576 replaces[Anum_pg_type_typstorage - 1] =
true;
4581 replaces[Anum_pg_type_typreceive - 1] =
true;
4586 replaces[Anum_pg_type_typsend - 1] =
true;
4591 replaces[Anum_pg_type_typmodin - 1] =
true;
4596 replaces[Anum_pg_type_typmodout - 1] =
true;
4601 replaces[Anum_pg_type_typanalyze - 1] =
true;
4606 replaces[Anum_pg_type_typsubscript - 1] =
true;
4611 values, nulls, replaces);
4633 if (!isImplicitArray &&
4645 elog(
ERROR,
"cache lookup failed for type %u", arrtypoid);
4647 memset(&arrparams, 0,
sizeof(arrparams));
4676 Anum_pg_type_typbasetype,
4691 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
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 TableScanDesc table_beginscan(Relation rel, Snapshot snapshot, int nkeys, struct ScanKeyData *key)
static void table_endscan(TableScanDesc scan)
static bool table_scan_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
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 void validateDomainCheckConstraint(Oid domainoid, const char *ccbin)
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 Node * replace_domain_constraint_value(ParseState *pstate, ColumnRef *cref)
bool contain_var_clause(Node *node)
void CommandCounterIncrement(void)