* Extract a TypeName from a DefElem. * * Note: we do not accept a List arg here, because the parser will only * return a bare List when the name looks like an operator name. */
| 252 | * return a bare List when the name looks like an operator name. |
| 253 | */ |
| 254 | TypeName * |
| 255 | defGetTypeName(DefElem *def) |
| 256 | { |
| 257 | if (def->arg == NULL) |
| 258 | ereport(ERROR, |
| 259 | (errcode(ERRCODE_SYNTAX_ERROR), |
| 260 | errmsg("%s requires a parameter", |
| 261 | def->defname))); |
| 262 | switch (nodeTag(def->arg)) |
| 263 | { |
| 264 | case T_TypeName: |
| 265 | return (TypeName *) def->arg; |
| 266 | case T_String: |
| 267 | /* Allow quoted typename for backwards compatibility */ |
| 268 | return makeTypeNameFromNameList(list_make1(def->arg)); |
| 269 | default: |
| 270 | ereport(ERROR, |
| 271 | (errcode(ERRCODE_SYNTAX_ERROR), |
| 272 | errmsg("argument of %s must be a type name", |
| 273 | def->defname))); |
| 274 | } |
| 275 | return NULL; /* keep compiler quiet */ |
| 276 | } |
| 277 | |
| 278 | /* |
| 279 | * Extract a type length indicator (either absolute bytes, or |
no test coverage detected