1/*-------------------------------------------------------------------------
4 * interface for value nodes
7 * Copyright (c) 2003-2025, PostgreSQL Global Development Group
9 * src/include/nodes/value.h
11 *-------------------------------------------------------------------------
20 * The node types Integer, Float, String, and BitString are used to represent
21 * literals in the lexer and are also used to pass constants around in the
22 * parser. One difference between these node types and, say, a plain int or
23 * char * is that the nodes can be put into a List.
25 * (There used to be a Value node, which encompassed all these different node types. Hence the name of this file.)
37 * Float is internally represented as string. Using T_Float as the node type
38 * simply indicates that the contents of the string look like a valid numeric
39 * literal. The value might end up being converted to NUMERIC, so we can't
40 * store it internally as a C double, since that could lose precision. Since
41 * these nodes are generally only used in the parsing process, not for runtime
42 * data, it's better to use the more general representation.
44 * Note that an integer-looking string will get lexed as T_Float if the value
45 * is too large to fit in an 'int'.
79 #define intVal(v) (castNode(Integer, v)->ival)
80 #define floatVal(v) atof(castNode(Float, v)->fval)
81 #define boolVal(v) (castNode(Boolean, v)->boolval)
82 #define strVal(v) (castNode(String, v)->sval)
pg_node_attr(special_read_write) NodeTag type
pg_node_attr(special_read_write) NodeTag type
pg_node_attr(special_read_write) NodeTag type
pg_node_attr(special_read_write) NodeTag type
pg_node_attr(special_read_write) NodeTag type
Integer * makeInteger(int i)
String * makeString(char *str)
BitString * makeBitString(char *str)
struct BitString BitString
Float * makeFloat(char *numericStr)
Boolean * makeBoolean(bool val)