68 #include "utils/fmgroids.h"
114 Oid rangeOid,
Oid subtype);
116 Oid multirangeOid,
Oid rangeOid,
117 Oid rangeArrayOid,
Oid *castFuncOid);
152 int16 internalLength = -1;
161 char category = TYPCATEGORY_USER;
162 bool preferred =
false;
165 char *defaultValue = NULL;
166 bool byValue =
false;
167 char alignment = TYPALIGN_INT;
168 char storage = TYPSTORAGE_PLAIN;
171 DefElem *internalLengthEl = NULL;
176 DefElem *typmodinNameEl = NULL;
177 DefElem *typmodoutNameEl = NULL;
179 DefElem *subscriptNameEl = NULL;
184 DefElem *defaultValueEl = NULL;
216 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
217 errmsg(
"must be superuser to create a base type")));
249 errmsg(
"type \"%s\" already exists", typeName)));
256 if (parameters ==
NIL)
261 errmsg(
"type \"%s\" already exists", typeName)));
274 errmsg(
"type \"%s\" does not exist", typeName),
275 errhint(
"Create the type as a shell type, then create its I/O functions, then do a full CREATE TYPE.")));
278 foreach(pl, parameters)
283 if (strcmp(defel->
defname,
"like") == 0)
284 defelp = &likeTypeEl;
285 else if (strcmp(defel->
defname,
"internallength") == 0)
286 defelp = &internalLengthEl;
287 else if (strcmp(defel->
defname,
"input") == 0)
288 defelp = &inputNameEl;
289 else if (strcmp(defel->
defname,
"output") == 0)
290 defelp = &outputNameEl;
291 else if (strcmp(defel->
defname,
"receive") == 0)
292 defelp = &receiveNameEl;
293 else if (strcmp(defel->
defname,
"send") == 0)
294 defelp = &sendNameEl;
295 else if (strcmp(defel->
defname,
"typmod_in") == 0)
296 defelp = &typmodinNameEl;
297 else if (strcmp(defel->
defname,
"typmod_out") == 0)
298 defelp = &typmodoutNameEl;
299 else if (strcmp(defel->
defname,
"analyze") == 0 ||
300 strcmp(defel->
defname,
"analyse") == 0)
301 defelp = &analyzeNameEl;
302 else if (strcmp(defel->
defname,
"subscript") == 0)
303 defelp = &subscriptNameEl;
304 else if (strcmp(defel->
defname,
"category") == 0)
305 defelp = &categoryEl;
306 else if (strcmp(defel->
defname,
"preferred") == 0)
307 defelp = &preferredEl;
308 else if (strcmp(defel->
defname,
"delimiter") == 0)
309 defelp = &delimiterEl;
310 else if (strcmp(defel->
defname,
"element") == 0)
311 defelp = &elemTypeEl;
312 else if (strcmp(defel->
defname,
"default") == 0)
313 defelp = &defaultValueEl;
314 else if (strcmp(defel->
defname,
"passedbyvalue") == 0)
316 else if (strcmp(defel->
defname,
"alignment") == 0)
317 defelp = &alignmentEl;
318 else if (strcmp(defel->
defname,
"storage") == 0)
320 else if (strcmp(defel->
defname,
"collatable") == 0)
321 defelp = &collatableEl;
326 (
errcode(ERRCODE_SYNTAX_ERROR),
327 errmsg(
"type attribute \"%s\" not recognized",
349 internalLength = likeForm->typlen;
350 byValue = likeForm->typbyval;
351 alignment = likeForm->typalign;
352 storage = likeForm->typstorage;
355 if (internalLengthEl)
379 if (category < 32 || category > 126)
381 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
382 errmsg(
"invalid type category \"%s\": must be simple ASCII",
400 (
errcode(ERRCODE_DATATYPE_MISMATCH),
401 errmsg(
"array element type cannot be %s",
420 alignment = TYPALIGN_DOUBLE;
423 alignment = TYPALIGN_INT;
426 alignment = TYPALIGN_SHORT;
429 alignment = TYPALIGN_CHAR;
432 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
433 errmsg(
"alignment \"%s\" not recognized",
a)));
449 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
450 errmsg(
"storage \"%s\" not recognized",
a)));
458 if (inputName ==
NIL)
460 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
461 errmsg(
"type input function must be specified")));
462 if (outputName ==
NIL)
464 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
465 errmsg(
"type output function must be specified")));
467 if (typmodinName ==
NIL && typmodoutName !=
NIL)
469 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
470 errmsg(
"type modifier output function is useless without a type modifier input function")));
507 if (internalLength > 0 && !byValue &&
get_typlen(elemType) > 0)
508 subscriptOid = F_RAW_ARRAY_SUBSCRIPT_HANDLER;
511 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
512 errmsg(
"element type cannot be specified without a subscripting function")));
609 alignment = (alignment == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
629 F_ARRAY_SUBSCRIPT_HANDLER,
662 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
696 char *domainArrayName;
699 int16 internalLength;
702 Oid receiveProcedure;
704 Oid analyzeProcedure;
713 char *defaultValue = NULL;
714 char *defaultValueBin = NULL;
715 bool saw_default =
false;
716 bool typNotNull =
false;
717 bool nullDefined =
false;
754 errmsg(
"type \"%s\" already exists", domainName)));
762 basetypeoid = baseType->oid;
772 typtype = baseType->typtype;
773 if (typtype != TYPTYPE_BASE &&
774 typtype != TYPTYPE_COMPOSITE &&
775 typtype != TYPTYPE_DOMAIN &&
776 typtype != TYPTYPE_ENUM &&
777 typtype != TYPTYPE_RANGE &&
778 typtype != TYPTYPE_MULTIRANGE)
780 (
errcode(ERRCODE_DATATYPE_MISMATCH),
781 errmsg(
"\"%s\" is not a valid base type for a domain",
797 baseColl = baseType->typcollation;
798 if (
stmt->collClause)
801 domaincoll = baseColl;
806 (
errcode(ERRCODE_DATATYPE_MISMATCH),
807 errmsg(
"collations are not supported by type %s",
811 byValue = baseType->typbyval;
814 alignment = baseType->typalign;
817 storage = baseType->typstorage;
820 internalLength = baseType->typlen;
823 category = baseType->typcategory;
826 delimiter = baseType->typdelim;
829 inputProcedure = F_DOMAIN_IN;
830 outputProcedure = baseType->typoutput;
831 receiveProcedure = F_DOMAIN_RECV;
832 sendProcedure = baseType->typsend;
837 analyzeProcedure = baseType->typanalyze;
847 Anum_pg_type_typdefault, &isnull);
853 Anum_pg_type_typdefaultbin, &isnull);
861 foreach(listptr, schema)
866 elog(
ERROR,
"unrecognized node type: %d",
878 (
errcode(ERRCODE_SYNTAX_ERROR),
879 errmsg(
"multiple default expressions")));
910 if (defaultExpr == NULL ||
912 ((
Const *) defaultExpr)->constisnull))
915 defaultValueBin = NULL;
934 defaultValueBin = NULL;
939 if (nullDefined && !typNotNull)
941 (
errcode(ERRCODE_SYNTAX_ERROR),
942 errmsg(
"conflicting NULL/NOT NULL constraints")));
948 if (nullDefined && typNotNull)
950 (
errcode(ERRCODE_SYNTAX_ERROR),
951 errmsg(
"conflicting NULL/NOT NULL constraints")));
966 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
967 errmsg(
"check constraints for domains cannot be marked NO INHERIT")));
975 (
errcode(ERRCODE_SYNTAX_ERROR),
976 errmsg(
"unique constraints not possible for domains")));
981 (
errcode(ERRCODE_SYNTAX_ERROR),
982 errmsg(
"primary key constraints not possible for domains")));
987 (
errcode(ERRCODE_SYNTAX_ERROR),
988 errmsg(
"exclusion constraints not possible for domains")));
993 (
errcode(ERRCODE_SYNTAX_ERROR),
994 errmsg(
"foreign key constraints not possible for domains")));
1002 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1003 errmsg(
"specifying constraint deferrability not supported for domains")));
1007 elog(
ERROR,
"unrecognized constraint subtype: %d",
1059 alignment = (alignment == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
1079 F_ARRAY_SUBSCRIPT_HANDLER,
1088 TYPSTORAGE_EXTENDED,
1094 pfree(domainArrayName);
1099 foreach(listptr, schema)
1109 basetypeoid, basetypeMod,
1110 constr, domainName, NULL);
1140 char *enumArrayName;
1169 errmsg(
"type \"%s\" already exists", enumName)));
1236 F_ARRAY_SUBSCRIPT_HANDLER,
1245 TYPSTORAGE_EXTENDED,
1251 pfree(enumArrayName);
1253 return enumTypeAddr;
1274 elog(
ERROR,
"cache lookup failed for type %u", enum_type_oid);
1290 stmt->newValNeighbor,
stmt->newValIsAfter,
1291 stmt->skipIfNewValExists);
1314 if (typTup->typtype != TYPTYPE_ENUM)
1316 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1317 errmsg(
"%s is not an enum",
1341 char *rangeArrayName;
1342 char *multirangeTypeName = NULL;
1343 char *multirangeArrayName;
1347 Oid multirangeArrayOid;
1349 List *rangeSubOpclassName =
NIL;
1350 List *rangeCollationName =
NIL;
1351 List *rangeCanonicalName =
NIL;
1352 List *rangeSubtypeDiffName =
NIL;
1353 Oid rangeSubOpclass;
1395 errmsg(
"type \"%s\" already exists", typeName)));
1404 foreach(lc,
stmt->params)
1408 if (strcmp(defel->
defname,
"subtype") == 0)
1415 else if (strcmp(defel->
defname,
"subtype_opclass") == 0)
1417 if (rangeSubOpclassName !=
NIL)
1421 else if (strcmp(defel->
defname,
"collation") == 0)
1423 if (rangeCollationName !=
NIL)
1427 else if (strcmp(defel->
defname,
"canonical") == 0)
1429 if (rangeCanonicalName !=
NIL)
1433 else if (strcmp(defel->
defname,
"subtype_diff") == 0)
1435 if (rangeSubtypeDiffName !=
NIL)
1439 else if (strcmp(defel->
defname,
"multirange_type_name") == 0)
1441 if (multirangeTypeName != NULL)
1445 &multirangeTypeName);
1449 (
errcode(ERRCODE_SYNTAX_ERROR),
1450 errmsg(
"type attribute \"%s\" not recognized",
1457 (
errcode(ERRCODE_SYNTAX_ERROR),
1458 errmsg(
"type attribute \"subtype\" is required")));
1462 (
errcode(ERRCODE_DATATYPE_MISMATCH),
1463 errmsg(
"range subtype cannot be %s",
1472 if (rangeCollationName !=
NIL)
1479 if (rangeCollationName !=
NIL)
1481 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1482 errmsg(
"range collation specified but subtype does not support collation")));
1487 if (rangeCanonicalName !=
NIL)
1491 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1492 errmsg(
"cannot specify a canonical function without a pre-created shell type"),
1493 errhint(
"Create the type as a shell type, then create its canonicalization function, then do a full CREATE TYPE.")));
1500 if (rangeSubtypeDiffName !=
NIL)
1507 &subtyplen, &subtypbyval, &subtypalign);
1510 alignment = (subtypalign == TYPALIGN_DOUBLE) ? TYPALIGN_DOUBLE : TYPALIGN_INT;
1546 TYPSTORAGE_EXTENDED,
1555 if (multirangeTypeName)
1575 errmsg(
"type \"%s\" already exists", multirangeTypeName)));
1581 multirangeNamespace = typeNamespace;
1588 multirangeNamespace,
1603 F_MULTIRANGE_TYPANALYZE,
1618 Assert(multirangeOid == mltrngaddress.objectId);
1621 RangeCreate(typoid, rangeSubtype, rangeCollation, rangeSubOpclass,
1622 rangeCanonical, rangeSubtypeDiff, multirangeOid);
1647 F_ARRAY_SUBSCRIPT_HANDLER,
1656 TYPSTORAGE_EXTENDED,
1662 pfree(rangeArrayName);
1669 multirangeArrayName,
1670 multirangeNamespace,
1686 F_ARRAY_SUBSCRIPT_HANDLER,
1704 multirangeOid, typoid, rangeArrayOid,
1709 COERCION_CODE_EXPLICIT, COERCION_METHOD_FUNCTION,
1712 pfree(multirangeArrayName);
1728 Oid rangeOid,
Oid subtype)
1730 static const char *
const prosrc[2] = {
"range_constructor2",
1731 "range_constructor3"};
1732 static const int pronargs[2] = {2, 3};
1734 Oid constructorArgTypes[3];
1739 constructorArgTypes[0] = subtype;
1740 constructorArgTypes[1] = subtype;
1741 constructorArgTypes[2] = TEXTOID;
1743 referenced.
classId = TypeRelationId;
1759 BOOTSTRAP_SUPERUSERID,
1761 F_FMGR_INTERNAL_VALIDATOR,
1769 PROVOLATILE_IMMUTABLE,
1771 constructorArgTypesVector,
1802 Oid multirangeOid,
Oid rangeOid,
Oid rangeArrayOid,
1808 Datum allParamTypes;
1813 referenced.
classId = TypeRelationId;
1814 referenced.
objectId = multirangeOid;
1824 BOOTSTRAP_SUPERUSERID,
1826 F_FMGR_INTERNAL_VALIDATOR,
1827 "multirange_constructor0",
1834 PROVOLATILE_IMMUTABLE,
1868 BOOTSTRAP_SUPERUSERID,
1870 F_FMGR_INTERNAL_VALIDATOR,
1871 "multirange_constructor1",
1878 PROVOLATILE_IMMUTABLE,
1906 BOOTSTRAP_SUPERUSERID,
1908 F_FMGR_INTERNAL_VALIDATOR,
1909 "multirange_constructor2",
1916 PROVOLATILE_IMMUTABLE,
1931 pfree(allParameterTypes);
1932 pfree(parameterModes);
1954 argList[0] = CSTRINGOID;
1955 argList[1] = OIDOID;
1956 argList[2] = INT4OID;
1964 (
errcode(ERRCODE_AMBIGUOUS_FUNCTION),
1965 errmsg(
"type input function %s has multiple matches",
1974 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
1975 errmsg(
"function %s does not exist",
1982 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1983 errmsg(
"type input function %s must return type %s",
1998 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1999 errmsg(
"type input function %s should not be volatile",
2015 argList[0] = typeOid;
2020 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2021 errmsg(
"function %s does not exist",
2026 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2027 errmsg(
"type output function %s must return type %s",
2033 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2034 errmsg(
"type output function %s should not be volatile",
2052 argList[0] = INTERNALOID;
2053 argList[1] = OIDOID;
2054 argList[2] = INT4OID;
2062 (
errcode(ERRCODE_AMBIGUOUS_FUNCTION),
2063 errmsg(
"type receive function %s has multiple matches",
2072 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2073 errmsg(
"function %s does not exist",
2080 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2081 errmsg(
"type receive function %s must return type %s",
2087 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2088 errmsg(
"type receive function %s should not be volatile",
2104 argList[0] = typeOid;
2109 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2110 errmsg(
"function %s does not exist",
2115 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2116 errmsg(
"type send function %s must return type %s",
2122 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2123 errmsg(
"type send function %s should not be volatile",
2138 argList[0] = CSTRINGARRAYOID;
2143 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2144 errmsg(
"function %s does not exist",
2149 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2150 errmsg(
"typmod_in function %s must return type %s",
2156 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2157 errmsg(
"type modifier input function %s should not be volatile",
2172 argList[0] = INT4OID;
2177 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2178 errmsg(
"function %s does not exist",
2183 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2184 errmsg(
"typmod_out function %s must return type %s",
2190 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2191 errmsg(
"type modifier output function %s should not be volatile",
2206 argList[0] = INTERNALOID;
2211 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2212 errmsg(
"function %s does not exist",
2217 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2218 errmsg(
"type analyze function %s must return type %s",
2235 argList[0] = INTERNALOID;
2240 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2241 errmsg(
"function %s does not exist",
2246 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2247 errmsg(
"type subscripting function %s must return type %s",
2254 if (procOid == F_ARRAY_SUBSCRIPT_HANDLER)
2256 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2257 errmsg(
"user-defined types cannot use subscripting function %s",
2288 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2289 errmsg(
"operator class \"%s\" does not accept data type %s",
2300 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2301 errmsg(
"data type %s has no default operator class for access method \"%s\"",
2303 errhint(
"You must specify an operator class for the range type or define a default operator class for the subtype.")));
2321 argList[0] = typeOid;
2327 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2328 errmsg(
"function %s does not exist",
2333 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2334 errmsg(
"range canonical function %s must return range type",
2339 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2340 errmsg(
"range canonical function %s must be immutable",
2362 argList[0] = subtype;
2363 argList[1] = subtype;
2369 (
errcode(ERRCODE_UNDEFINED_FUNCTION),
2370 errmsg(
"function %s does not exist",
2375 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2376 errmsg(
"range subtype diff function %s must return type %s",
2378 "double precision")));
2382 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2383 errmsg(
"range subtype diff function %s must be immutable",
2409 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2410 errmsg(
"pg_type array OID value not set when in binary upgrade mode")));
2424 return type_array_oid;
2435 Oid type_multirange_oid;
2442 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2443 errmsg(
"pg_type multirange OID value not set when in binary upgrade mode")));
2457 return type_multirange_oid;
2468 Oid type_multirange_array_oid;
2475 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2476 errmsg(
"pg_type multirange array OID value not set when in binary upgrade mode")));
2490 return type_multirange_array_oid;
2574 Node *defaultExpr = NULL;
2575 Datum new_record[Natts_pg_type] = {0};
2576 bool new_record_nulls[Natts_pg_type] = {0};
2577 bool new_record_repl[Natts_pg_type] = {0};
2591 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2610 typTup->typbasetype,
2620 if (defaultExpr == NULL ||
2621 (
IsA(defaultExpr,
Const) && ((
Const *) defaultExpr)->constisnull))
2625 new_record_nulls[Anum_pg_type_typdefaultbin - 1] =
true;
2626 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2627 new_record_nulls[Anum_pg_type_typdefault - 1] =
true;
2628 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2645 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2647 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2653 new_record_nulls[Anum_pg_type_typdefaultbin - 1] =
true;
2654 new_record_repl[Anum_pg_type_typdefaultbin - 1] =
true;
2655 new_record_nulls[Anum_pg_type_typdefault - 1] =
true;
2656 new_record_repl[Anum_pg_type_typdefault - 1] =
true;
2660 new_record, new_record_nulls,
2713 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2720 if (typTup->typnotnull == notNull)
2771 (
errcode(ERRCODE_NOT_NULL_VIOLATION),
2772 errmsg(
"column \"%s\" of table \"%s\" contains null values",
2792 typTup->typnotnull = notNull;
2838 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2848 Anum_pg_constraint_conrelid,
2852 Anum_pg_constraint_contypid,
2856 Anum_pg_constraint_conname,
2868 conobj.
classId = ConstraintRelationId;
2884 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2885 errmsg(
"constraint \"%s\" of domain \"%s\" does not exist",
2889 (
errmsg(
"constraint \"%s\" of domain \"%s\" does not exist, skipping",
2935 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
2942 elog(
ERROR,
"unrecognized node type: %d",
2943 (
int)
nodeTag(newConstraint));
2955 (
errcode(ERRCODE_SYNTAX_ERROR),
2956 errmsg(
"unique constraints not possible for domains")));
2961 (
errcode(ERRCODE_SYNTAX_ERROR),
2962 errmsg(
"primary key constraints not possible for domains")));
2967 (
errcode(ERRCODE_SYNTAX_ERROR),
2968 errmsg(
"exclusion constraints not possible for domains")));
2973 (
errcode(ERRCODE_SYNTAX_ERROR),
2974 errmsg(
"foreign key constraints not possible for domains")));
2982 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2983 errmsg(
"specifying constraint deferrability not supported for domains")));
2987 elog(
ERROR,
"unrecognized constraint subtype: %d",
2999 typTup->typbasetype, typTup->typtypmod,
3000 constr,
NameStr(typTup->typname), constrAddr);
3057 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
3068 Anum_pg_constraint_conrelid,
3072 Anum_pg_constraint_contypid,
3076 Anum_pg_constraint_conname,
3086 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3087 errmsg(
"constraint \"%s\" of domain \"%s\" does not exist",
3091 if (con->contype != CONSTRAINT_CHECK)
3093 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3094 errmsg(
"constraint \"%s\" of domain \"%s\" is not a check constraint",
3098 Anum_pg_constraint_conbin,
3101 elog(
ERROR,
"null conbin for constraint %u",
3112 copy_con->convalidated =
true;
3199 (
errcode(ERRCODE_CHECK_VIOLATION),
3200 errmsg(
"column \"%s\" of table \"%s\" contains values that violate the new constraint",
3273 Anum_pg_depend_refclassid,
3277 Anum_pg_depend_refobjid,
3293 if (pg_depend->classid == TypeRelationId)
3295 if (
get_typtype(pg_depend->objid) == TYPTYPE_DOMAIN)
3323 if (pg_depend->classid != RelationRelationId ||
3324 pg_depend->objsubid <= 0)
3328 foreach(rellist, result)
3364 if (rel->
rd_rel->relkind != RELKIND_RELATION &&
3365 rel->
rd_rel->relkind != RELKIND_MATVIEW)
3376 result =
lappend(result, rtc);
3388 if (pg_att->attisdropped || pg_att->atttypid != domainOid)
3399 while (ptr > 0 && rtc->
atts[ptr - 1] > pg_depend->objsubid)
3401 rtc->
atts[ptr] = rtc->
atts[ptr - 1];
3404 rtc->
atts[ptr] = pg_depend->objsubid;
3426 if (typTup->typtype != TYPTYPE_DOMAIN)
3428 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3429 errmsg(
"%s is not a domain",
3461 errmsg(
"constraint \"%s\" for domain \"%s\" already exists",
3462 constr->
conname, domainName)));
3484 domVal->
typeId = baseTypeOid;
3485 domVal->typeMod = typMod;
3511 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3512 errmsg(
"cannot use table references in domain check constraint")));
3579 colname =
strVal(field1);
3580 if (strcmp(colname,
"value") == 0)
3586 return (
Node *) domVal;
3600 const char *newTypeName =
stmt->newname;
3617 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3627 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3628 errmsg(
"%s is not a domain",
3636 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3639 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3640 errmsg(
"%s is a table's row type",
3642 errhint(
"Use ALTER TABLE instead.")));
3645 if (IsTrueArrayType(typTup))
3647 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3648 errmsg(
"cannot alter array type %s",
3650 errhint(
"You can alter type %s, which will alter the array type as well.",
3657 if (typTup->typtype == TYPTYPE_COMPOSITE)
3661 typTup->typnamespace);
3694 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3695 errmsg(
"type \"%s\" does not exist",
3706 if (objecttype ==
OBJECT_DOMAIN && typTup->typtype != TYPTYPE_DOMAIN)
3708 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3709 errmsg(
"%s is not a domain",
3717 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3720 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3721 errmsg(
"%s is a table's row type",
3723 errhint(
"Use ALTER TABLE instead.")));
3726 if (IsTrueArrayType(typTup))
3728 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3729 errmsg(
"cannot alter array type %s",
3731 errhint(
"You can alter type %s, which will alter the array type as well.",
3738 if (typTup->typowner != newOwnerId)
3751 aclresult =
object_aclcheck(NamespaceRelationId, typTup->typnamespace,
3792 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3800 if (typTup->typtype == TYPTYPE_COMPOSITE)
3827 Datum repl_val[Natts_pg_type];
3828 bool repl_null[Natts_pg_type];
3829 bool repl_repl[Natts_pg_type];
3838 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3841 memset(repl_null,
false,
sizeof(repl_null));
3842 memset(repl_repl,
false,
sizeof(repl_repl));
3844 repl_repl[Anum_pg_type_typowner - 1] =
true;
3848 Anum_pg_type_typacl,
3855 typTup->typowner, newOwnerId);
3856 repl_repl[Anum_pg_type_typacl - 1] =
true;
3894 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3895 errmsg(
"%s is not a domain",
3906 *oldschema = oldNspOid;
3926 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3927 errmsg(
"cannot alter array type %s",
3929 errhint(
"You can alter type %s, which will alter the array type as well.",
3953 bool isImplicitArray,
3954 bool errorOnTableType,
3962 bool isCompositeType;
3968 thisobj.
classId = TypeRelationId;
3979 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3982 oldNspOid = typform->typnamespace;
3983 arrayOid = typform->typarray;
3986 if (oldNspOid != nspOid)
3997 errmsg(
"type \"%s\" already exists in schema \"%s\"",
4004 (typform->typtype == TYPTYPE_COMPOSITE &&
4008 if (typform->typtype == TYPTYPE_COMPOSITE && !isCompositeType &&
4011 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4012 errmsg(
"%s is a table's row type",
4014 errhint(
"Use ALTER TABLE instead.")));
4016 if (oldNspOid != nspOid)
4021 typform->typnamespace = nspOid;
4032 if (isCompositeType)
4049 nspOid,
false, objsMoved);
4054 if (typform->typtype == TYPTYPE_DOMAIN)
4063 if (oldNspOid != nspOid &&
4064 (isCompositeType || typform->typtype != TYPTYPE_COMPOSITE) &&
4067 NamespaceRelationId, oldNspOid, nspOid) != 1)
4068 elog(
ERROR,
"failed to change schema dependency for type %s",
4103 bool requireSuper =
false;
4117 memset(&atparams, 0,
sizeof(atparams));
4118 foreach(pl,
stmt->options)
4122 if (strcmp(defel->
defname,
"storage") == 0)
4127 atparams.
storage = TYPSTORAGE_PLAIN;
4129 atparams.
storage = TYPSTORAGE_EXTERNAL;
4131 atparams.
storage = TYPSTORAGE_EXTENDED;
4133 atparams.
storage = TYPSTORAGE_MAIN;
4136 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4137 errmsg(
"storage \"%s\" not recognized",
a)));
4143 if (atparams.
storage != TYPSTORAGE_PLAIN && typForm->typlen != -1)
4145 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4146 errmsg(
"fixed-size types must have storage PLAIN")));
4158 if (atparams.
storage != TYPSTORAGE_PLAIN &&
4159 typForm->typstorage == TYPSTORAGE_PLAIN)
4160 requireSuper =
true;
4161 else if (atparams.
storage == TYPSTORAGE_PLAIN &&
4162 typForm->typstorage != TYPSTORAGE_PLAIN)
4164 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4165 errmsg(
"cannot change type's storage to PLAIN")));
4169 else if (strcmp(defel->
defname,
"receive") == 0)
4171 if (defel->
arg != NULL)
4179 requireSuper =
true;
4181 else if (strcmp(defel->
defname,
"send") == 0)
4183 if (defel->
arg != NULL)
4191 requireSuper =
true;
4193 else if (strcmp(defel->
defname,
"typmod_in") == 0)
4195 if (defel->
arg != NULL)
4202 requireSuper =
true;
4204 else if (strcmp(defel->
defname,
"typmod_out") == 0)
4206 if (defel->
arg != NULL)
4213 requireSuper =
true;
4215 else if (strcmp(defel->
defname,
"analyze") == 0)
4217 if (defel->
arg != NULL)
4225 requireSuper =
true;
4227 else if (strcmp(defel->
defname,
"subscript") == 0)
4229 if (defel->
arg != NULL)
4237 requireSuper =
true;
4244 else if (strcmp(defel->
defname,
"input") == 0 ||
4245 strcmp(defel->
defname,
"output") == 0 ||
4246 strcmp(defel->
defname,
"internallength") == 0 ||
4247 strcmp(defel->
defname,
"passedbyvalue") == 0 ||
4248 strcmp(defel->
defname,
"alignment") == 0 ||
4249 strcmp(defel->
defname,
"like") == 0 ||
4250 strcmp(defel->
defname,
"category") == 0 ||
4251 strcmp(defel->
defname,
"preferred") == 0 ||
4252 strcmp(defel->
defname,
"default") == 0 ||
4253 strcmp(defel->
defname,
"element") == 0 ||
4254 strcmp(defel->
defname,
"delimiter") == 0 ||
4255 strcmp(defel->
defname,
"collatable") == 0)
4257 (
errcode(ERRCODE_SYNTAX_ERROR),
4258 errmsg(
"type attribute \"%s\" cannot be changed",
4262 (
errcode(ERRCODE_SYNTAX_ERROR),
4263 errmsg(
"type attribute \"%s\" not recognized",
4275 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
4276 errmsg(
"must be superuser to alter a type")));
4294 if (typForm->typtype != TYPTYPE_BASE)
4296 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4297 errmsg(
"%s is not a base type",
4303 if (IsTrueArrayType(typForm))
4305 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4306 errmsg(
"%s is not a base type",
4351 bool nulls[Natts_pg_type];
4352 bool replaces[Natts_pg_type];
4363 memset(nulls, 0,
sizeof(nulls));
4364 memset(replaces, 0,
sizeof(replaces));
4368 replaces[Anum_pg_type_typstorage - 1] =
true;
4373 replaces[Anum_pg_type_typreceive - 1] =
true;
4378 replaces[Anum_pg_type_typsend - 1] =
true;
4383 replaces[Anum_pg_type_typmodin - 1] =
true;
4388 replaces[Anum_pg_type_typmodout - 1] =
true;
4393 replaces[Anum_pg_type_typanalyze - 1] =
true;
4398 replaces[Anum_pg_type_typsubscript - 1] =
true;
4403 values, nulls, replaces);
4425 if (!isImplicitArray &&
4437 elog(
ERROR,
"cache lookup failed for type %u", arrtypoid);
4439 memset(&arrparams, 0,
sizeof(arrparams));
4468 Anum_pg_type_typbasetype,
4483 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)
elog(ERROR, "%s: %s", p2, msg)
int defGetTypeLength(DefElem *def)
bool defGetBoolean(DefElem *def)
List * defGetQualifiedName(DefElem *def)
char * defGetString(DefElem *def)
void errorConflictingDefElem(DefElem *defel, ParseState *pstate)
TypeName * defGetTypeName(DefElem *def)
void performDeletion(const ObjectAddress *object, DropBehavior behavior, int flags)
bool object_address_present(const ObjectAddress *object, const ObjectAddresses *addrs)
ObjectAddresses * new_object_addresses(void)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
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)
EState * CreateExecutorState(void)
void FreeExecutorState(EState *estate)
#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)
Node * cookDefault(ParseState *pstate, Node *raw_default, Oid atttypid, int32 atttypmod, const char *attname, char attgenerated)
HeapTuple heap_copytuple(HeapTuple tuple)
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, Datum *replValues, bool *replIsnull, bool *doReplace)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
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)
Assert(fmt[strlen(fmt) - 1] !='\n')
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)
char * get_namespace_name(Oid nspid)
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)
bool type_is_collatable(Oid typid)
int16 get_typlen(Oid typid)
char get_typtype(Oid typid)
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)
Oid QualifiedNameGetCreationNamespace(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)
char * NameListToString(List *names)
#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)
Node * coerce_to_boolean(ParseState *pstate, Node *node, const char *constructName)
bool IsBinaryCoercible(Oid srctype, Oid targettype)
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)
int parser_errposition(ParseState *pstate, int location)
ParseState * make_parsestate(ParseState *parentParseState)
Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool missing_ok)
char * TypeNameToString(const TypeName *typeName)
Type typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p)
Oid typenameTypeId(ParseState *pstate, const TypeName *typeName)
@ CONSTR_ATTR_NOT_DEFERRABLE
FormData_pg_attribute * Form_pg_attribute
ObjectAddress CastCreate(Oid sourcetypeid, Oid targettypeid, Oid funcid, Oid incastid, Oid outcastid, char castcontext, char castmethod, DependencyType behavior)
char * ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others)
bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId, const char *conname)
void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, Oid newNspId, bool isType, ObjectAddresses *objsMoved)
Oid CreateConstraintEntry(const char *constraintName, Oid constraintNamespace, char constraintType, bool isDeferrable, bool isDeferred, 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, int conInhCount, bool conNoInherit, bool is_internal)
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, 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)
char * makeMultirangeTypeName(const char *rangeTypeName, Oid typeNamespace)
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)
char * makeArrayTypeName(const char *typeName, Oid typeNamespace)
bool moveArrayTypeName(Oid typeOid, const char *typeName, Oid typeNamespace)
ObjectAddress TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId)
FormData_pg_type * Form_pg_type
int pg_strcasecmp(const char *s1, const char *s2)
void check_stack_depth(void)
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)
#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)
#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)
#define TupleDescAttr(tupdesc, 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)
ObjectAddress DefineDomain(CreateDomainStmt *stmt)
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 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)
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)
static void validateDomainConstraint(Oid domainoid, char *ccbin)
ObjectAddress AlterEnum(AlterEnumStmt *stmt)
ObjectAddress AlterDomainAddConstraint(List *names, Node *newConstraint, ObjectAddress *constrAddr)
void RemoveTypeById(Oid typeOid)
ObjectAddress AlterDomainValidateConstraint(List *names, const char *constrName)
static Oid findTypeSubscriptingFunction(List *procname, Oid typeOid)
static char * domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, int typMod, Constraint *constr, const char *domainName, ObjectAddress *constrAddr)
static Oid findTypeTypmodoutFunction(List *procname)
static Oid findTypeTypmodinFunction(List *procname)
ObjectAddress AlterDomainDefault(List *names, Node *defaultRaw)
Oid binary_upgrade_next_array_pg_type_oid
Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, bool isImplicitArray, bool errorOnTableType, ObjectAddresses *objsMoved)
ObjectAddress RenameType(RenameStmt *stmt)
Oid AssignTypeArrayOid(void)
Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved)
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)
Oid AssignTypeMultirangeArrayOid(void)
ObjectAddress AlterType(AlterTypeStmt *stmt)
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)