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

Function defGetString

src/backend/commands/define.c:48–79  ·  view source on GitHub ↗

* Extract a string value (otherwise uninterpreted) from a DefElem. */

Source from the content-addressed store, hash-verified

46 * Extract a string value (otherwise uninterpreted) from a DefElem.
47 */
48char *
49defGetString(DefElem *def)
50{
51 if (def->arg == NULL)
52 ereport(ERROR,
53 (errcode(ERRCODE_SYNTAX_ERROR),
54 errmsg("%s requires a parameter",
55 def->defname)));
56 switch (nodeTag(def->arg))
57 {
58 case T_Integer:
59 return psprintf("%ld", (long) intVal(def->arg));
60 case T_Float:
61
62 /*
63 * T_Float values are kept in string form, so this type cheat
64 * works (and doesn't risk losing precision)
65 */
66 return strVal(def->arg);
67 case T_String:
68 return strVal(def->arg);
69 case T_TypeName:
70 return TypeNameToString((TypeName *) def->arg);
71 case T_List:
72 return NameListToString((List *) def->arg);
73 case T_A_Star:
74 return pstrdup("*");
75 default:
76 elog(ERROR, "unrecognized node type: %d", (int) nodeTag(def->arg));
77 }
78 return NULL; /* keep compiler quiet */
79}
80
81/*
82 * Extract a numeric value (actually double) from a DefElem.

Callers 15

deparseAnalyzeSqlFunction · 0.85
deparseColumnRefFunction · 0.85
deparseRelationFunction · 0.85
postgres_fdw_validatorFunction · 0.85
ExtractConnectionOptionsFunction · 0.85
apply_server_optionsFunction · 0.85
apply_table_optionsFunction · 0.85
get_batch_size_optionFunction · 0.85
file_fdw_validatorFunction · 0.85
fileGetOptionsFunction · 0.85

Calls 6

psprintfFunction · 0.85
TypeNameToStringFunction · 0.85
NameListToStringFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
pstrdupFunction · 0.50

Tested by

no test coverage detected