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);
3056 elog(
ERROR,
"cache lookup failed for type %u", domainoid);
3067 Anum_pg_constraint_conrelid,
3071 Anum_pg_constraint_contypid,
3075 Anum_pg_constraint_conname,
3085 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3086 errmsg(
"constraint \"%s\" of domain \"%s\" does not exist",
3090 if (con->contype != CONSTRAINT_CHECK)
3092 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3093 errmsg(
"constraint \"%s\" of domain \"%s\" is not a check constraint",
3106 copy_con->convalidated =
true;
3193 (
errcode(ERRCODE_CHECK_VIOLATION),
3194 errmsg(
"column \"%s\" of table \"%s\" contains values that violate the new constraint",
3267 Anum_pg_depend_refclassid,
3271 Anum_pg_depend_refobjid,
3287 if (pg_depend->classid == TypeRelationId)
3289 if (
get_typtype(pg_depend->objid) == TYPTYPE_DOMAIN)
3317 if (pg_depend->classid != RelationRelationId ||
3318 pg_depend->objsubid <= 0)
3322 foreach(rellist, result)
3358 if (rel->
rd_rel->relkind != RELKIND_RELATION &&
3359 rel->
rd_rel->relkind != RELKIND_MATVIEW)
3370 result =
lappend(result, rtc);
3382 if (pg_att->attisdropped || pg_att->atttypid != domainOid)
3393 while (ptr > 0 && rtc->
atts[ptr - 1] > pg_depend->objsubid)
3395 rtc->
atts[ptr] = rtc->
atts[ptr - 1];
3398 rtc->
atts[ptr] = pg_depend->objsubid;
3420 if (typTup->typtype != TYPTYPE_DOMAIN)
3422 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3423 errmsg(
"%s is not a domain",
3455 errmsg(
"constraint \"%s\" for domain \"%s\" already exists",
3456 constr->
conname, domainName)));
3478 domVal->
typeId = baseTypeOid;
3479 domVal->typeMod = typMod;
3505 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
3506 errmsg(
"cannot use table references in domain check constraint")));
3573 colname =
strVal(field1);
3574 if (strcmp(colname,
"value") == 0)
3580 return (
Node *) domVal;
3594 const char *newTypeName =
stmt->newname;
3611 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3621 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3622 errmsg(
"%s is not a domain",
3630 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3633 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3634 errmsg(
"%s is a table's row type",
3636 errhint(
"Use ALTER TABLE instead.")));
3639 if (IsTrueArrayType(typTup))
3641 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3642 errmsg(
"cannot alter array type %s",
3644 errhint(
"You can alter type %s, which will alter the array type as well.",
3651 if (typTup->typtype == TYPTYPE_COMPOSITE)
3655 typTup->typnamespace);
3688 (
errcode(ERRCODE_UNDEFINED_OBJECT),
3689 errmsg(
"type \"%s\" does not exist",
3700 if (objecttype ==
OBJECT_DOMAIN && typTup->typtype != TYPTYPE_DOMAIN)
3702 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3703 errmsg(
"%s is not a domain",
3711 if (typTup->typtype == TYPTYPE_COMPOSITE &&
3714 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3715 errmsg(
"%s is a table's row type",
3717 errhint(
"Use ALTER TABLE instead.")));
3720 if (IsTrueArrayType(typTup))
3722 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3723 errmsg(
"cannot alter array type %s",
3725 errhint(
"You can alter type %s, which will alter the array type as well.",
3732 if (typTup->typowner != newOwnerId)
3745 aclresult =
object_aclcheck(NamespaceRelationId, typTup->typnamespace,
3786 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3794 if (typTup->typtype == TYPTYPE_COMPOSITE)
3821 Datum repl_val[Natts_pg_type];
3822 bool repl_null[Natts_pg_type];
3823 bool repl_repl[Natts_pg_type];
3832 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3835 memset(repl_null,
false,
sizeof(repl_null));
3836 memset(repl_repl,
false,
sizeof(repl_repl));
3838 repl_repl[Anum_pg_type_typowner - 1] =
true;
3842 Anum_pg_type_typacl,
3849 typTup->typowner, newOwnerId);
3850 repl_repl[Anum_pg_type_typacl - 1] =
true;
3888 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3889 errmsg(
"%s is not a domain",
3900 *oldschema = oldNspOid;
3920 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3921 errmsg(
"cannot alter array type %s",
3923 errhint(
"You can alter type %s, which will alter the array type as well.",
3947 bool isImplicitArray,
3948 bool errorOnTableType,
3956 bool isCompositeType;
3962 thisobj.
classId = TypeRelationId;
3973 elog(
ERROR,
"cache lookup failed for type %u", typeOid);
3976 oldNspOid = typform->typnamespace;
3977 arrayOid = typform->typarray;
3980 if (oldNspOid != nspOid)
3991 errmsg(
"type \"%s\" already exists in schema \"%s\"",
3998 (typform->typtype == TYPTYPE_COMPOSITE &&
4002 if (typform->typtype == TYPTYPE_COMPOSITE && !isCompositeType &&
4005 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4006 errmsg(
"%s is a table's row type",
4008 errhint(
"Use ALTER TABLE instead.")));
4010 if (oldNspOid != nspOid)
4015 typform->typnamespace = nspOid;
4026 if (isCompositeType)
4043 nspOid,
false, objsMoved);
4048 if (typform->typtype == TYPTYPE_DOMAIN)
4057 if (oldNspOid != nspOid &&
4058 (isCompositeType || typform->typtype != TYPTYPE_COMPOSITE) &&
4061 NamespaceRelationId, oldNspOid, nspOid) != 1)
4062 elog(
ERROR,
"could not change schema dependency for type \"%s\"",
4097 bool requireSuper =
false;
4111 memset(&atparams, 0,
sizeof(atparams));
4112 foreach(pl,
stmt->options)
4116 if (strcmp(defel->
defname,
"storage") == 0)
4121 atparams.
storage = TYPSTORAGE_PLAIN;
4123 atparams.
storage = TYPSTORAGE_EXTERNAL;
4125 atparams.
storage = TYPSTORAGE_EXTENDED;
4127 atparams.
storage = TYPSTORAGE_MAIN;
4130 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4131 errmsg(
"storage \"%s\" not recognized",
a)));
4137 if (atparams.
storage != TYPSTORAGE_PLAIN && typForm->typlen != -1)
4139 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4140 errmsg(
"fixed-size types must have storage PLAIN")));
4152 if (atparams.
storage != TYPSTORAGE_PLAIN &&
4153 typForm->typstorage == TYPSTORAGE_PLAIN)
4154 requireSuper =
true;
4155 else if (atparams.
storage == TYPSTORAGE_PLAIN &&
4156 typForm->typstorage != TYPSTORAGE_PLAIN)
4158 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
4159 errmsg(
"cannot change type's storage to PLAIN")));
4163 else if (strcmp(defel->
defname,
"receive") == 0)
4165 if (defel->
arg != NULL)
4173 requireSuper =
true;
4175 else if (strcmp(defel->
defname,
"send") == 0)
4177 if (defel->
arg != NULL)
4185 requireSuper =
true;
4187 else if (strcmp(defel->
defname,
"typmod_in") == 0)
4189 if (defel->
arg != NULL)
4196 requireSuper =
true;
4198 else if (strcmp(defel->
defname,
"typmod_out") == 0)
4200 if (defel->
arg != NULL)
4207 requireSuper =
true;
4209 else if (strcmp(defel->
defname,
"analyze") == 0)
4211 if (defel->
arg != NULL)
4219 requireSuper =
true;
4221 else if (strcmp(defel->
defname,
"subscript") == 0)
4223 if (defel->
arg != NULL)
4231 requireSuper =
true;
4238 else if (strcmp(defel->
defname,
"input") == 0 ||
4239 strcmp(defel->
defname,
"output") == 0 ||
4240 strcmp(defel->
defname,
"internallength") == 0 ||
4241 strcmp(defel->
defname,
"passedbyvalue") == 0 ||
4242 strcmp(defel->
defname,
"alignment") == 0 ||
4243 strcmp(defel->
defname,
"like") == 0 ||
4244 strcmp(defel->
defname,
"category") == 0 ||
4245 strcmp(defel->
defname,
"preferred") == 0 ||
4246 strcmp(defel->
defname,
"default") == 0 ||
4247 strcmp(defel->
defname,
"element") == 0 ||
4248 strcmp(defel->
defname,
"delimiter") == 0 ||
4249 strcmp(defel->
defname,
"collatable") == 0)
4251 (
errcode(ERRCODE_SYNTAX_ERROR),
4252 errmsg(
"type attribute \"%s\" cannot be changed",
4256 (
errcode(ERRCODE_SYNTAX_ERROR),
4257 errmsg(
"type attribute \"%s\" not recognized",
4269 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
4270 errmsg(
"must be superuser to alter a type")));
4288 if (typForm->typtype != TYPTYPE_BASE)
4290 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4291 errmsg(
"%s is not a base type",
4297 if (IsTrueArrayType(typForm))
4299 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
4300 errmsg(
"%s is not a base type",
4345 bool nulls[Natts_pg_type];
4346 bool replaces[Natts_pg_type];
4357 memset(nulls, 0,
sizeof(nulls));
4358 memset(replaces, 0,
sizeof(replaces));
4362 replaces[Anum_pg_type_typstorage - 1] =
true;
4367 replaces[Anum_pg_type_typreceive - 1] =
true;
4372 replaces[Anum_pg_type_typsend - 1] =
true;
4377 replaces[Anum_pg_type_typmodin - 1] =
true;
4382 replaces[Anum_pg_type_typmodout - 1] =
true;
4387 replaces[Anum_pg_type_typanalyze - 1] =
true;
4392 replaces[Anum_pg_type_typsubscript - 1] =
true;
4397 values, nulls, replaces);
4419 if (!isImplicitArray &&
4431 elog(
ERROR,
"cache lookup failed for type %u", arrtypoid);
4433 memset(&arrparams, 0,
sizeof(arrparams));
4462 Anum_pg_type_typbasetype,
4477 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(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)
char * NameListToString(const 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)
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)
#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)