* Special handling of type definition for a column */
| 4951 | * Special handling of type definition for a column |
| 4952 | */ |
| 4953 | static void |
| 4954 | transformColumnType(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 | /* |
no test coverage detected