MCPcopy Create free account
hub / github.com/apache/cloudberry / transformColumnType

Function transformColumnType

src/backend/parser/parse_utilcmd.c:4953–4980  ·  view source on GitHub ↗

* Special handling of type definition for a column */

Source from the content-addressed store, hash-verified

4951 * Special handling of type definition for a column
4952 */
4953static void
4954transformColumnType(CreateStmtContext *cxt, ColumnDef *column)
4955{
4956 /*
4957 * All we really need to do here is verify that the type is valid,
4958 * including any collation spec that might be present.
4959 */
4960 Type ctype = typenameType(cxt->pstate, column->typeName, NULL);
4961
4962 if (column->collClause)
4963 {
4964 Form_pg_type typtup = (Form_pg_type) GETSTRUCT(ctype);
4965
4966 LookupCollation(cxt->pstate,
4967 column->collClause->collname,
4968 column->collClause->location);
4969 /* Complain if COLLATE is applied to an uncollatable type */
4970 if (!OidIsValid(typtup->typcollation))
4971 ereport(ERROR,
4972 (errcode(ERRCODE_DATATYPE_MISMATCH),
4973 errmsg("collations are not supported by type %s",
4974 format_type_be(typtup->oid)),
4975 parser_errposition(cxt->pstate,
4976 column->collClause->location)));
4977 }
4978
4979 ReleaseSysCache(ctype);
4980}
4981
4982
4983/*

Callers 1

Calls 7

typenameTypeFunction · 0.85
LookupCollationFunction · 0.85
format_type_beFunction · 0.85
parser_errpositionFunction · 0.85
ReleaseSysCacheFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected