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

Function defGetNumeric

src/backend/commands/define.c:84–105  ·  view source on GitHub ↗

* Extract a numeric value (actually double) from a DefElem. */

Source from the content-addressed store, hash-verified

82 * Extract a numeric value (actually double) from a DefElem.
83 */
84double
85defGetNumeric(DefElem *def)
86{
87 if (def->arg == NULL)
88 ereport(ERROR,
89 (errcode(ERRCODE_SYNTAX_ERROR),
90 errmsg("%s requires a numeric value",
91 def->defname)));
92 switch (nodeTag(def->arg))
93 {
94 case T_Integer:
95 return (double) intVal(def->arg);
96 case T_Float:
97 return floatVal(def->arg);
98 default:
99 ereport(ERROR,
100 (errcode(ERRCODE_SYNTAX_ERROR),
101 errmsg("%s requires a numeric value",
102 def->defname)));
103 }
104 return 0; /* keep compiler quiet */
105}
106
107/*
108 * Extract a boolean value from a DefElem.

Callers 4

CreateQueueFunction · 0.85
AlterQueueFunction · 0.85
AlterFunctionFunction · 0.85

Calls 2

errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected