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

Function defGetInt64

src/backend/commands/define.c:189–217  ·  view source on GitHub ↗

* Extract an int64 value from a DefElem. */

Source from the content-addressed store, hash-verified

187 * Extract an int64 value from a DefElem.
188 */
189int64
190defGetInt64(DefElem *def)
191{
192 if (def->arg == NULL)
193 ereport(ERROR,
194 (errcode(ERRCODE_SYNTAX_ERROR),
195 errmsg("%s requires a numeric value",
196 def->defname)));
197 switch (nodeTag(def->arg))
198 {
199 case T_Integer:
200 return (int64) intVal(def->arg);
201 case T_Float:
202
203 /*
204 * Values too large for int4 will be represented as Float
205 * constants by the lexer. Accept these if they are valid int8
206 * strings.
207 */
208 return DatumGetInt64(DirectFunctionCall1(int8in,
209 CStringGetDatum(strVal(def->arg))));
210 default:
211 ereport(ERROR,
212 (errcode(ERRCODE_SYNTAX_ERROR),
213 errmsg("%s requires a numeric value",
214 def->defname)));
215 }
216 return 0; /* keep compiler quiet */
217}
218
219/*
220 * Extract a possibly-qualified name (as a List of Strings) from a DefElem.

Callers 4

CreateQueueFunction · 0.85
AlterQueueFunction · 0.85
getResgroupOptionValueFunction · 0.85
init_paramsFunction · 0.85

Calls 4

DatumGetInt64Function · 0.85
CStringGetDatumFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected