diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-01-14 10:46:49 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-01-17 10:38:23 +0100 |
commit | 941460fcf731a32e6a90691508d5cfa3d1f8eeaf (patch) | |
tree | 2de0be4abcf7db131607ce9ba590a8040c16d6e3 /src/backend/parser/parse_node.c | |
parent | ca86a63d207aca1f52ff13a1ce13854681d1bbf9 (diff) | |
download | postgresql-941460fcf731a32e6a90691508d5cfa3d1f8eeaf.tar.gz postgresql-941460fcf731a32e6a90691508d5cfa3d1f8eeaf.zip |
Add Boolean node
Before, SQL-level boolean constants were represented by a string with
a cast, and internal Boolean values in DDL commands were usually
represented by Integer nodes. This takes the place of both of these
uses, making the intent clearer and having some amount of type safety.
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8c1a2e37-c68d-703c-5a83-7a6077f4f997@enterprisedb.com
Diffstat (limited to 'src/backend/parser/parse_node.c')
-rw-r--r-- | src/backend/parser/parse_node.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index 95913c80215..35db6b6c988 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -426,6 +426,14 @@ make_const(ParseState *pstate, A_Const *aconst) } break; + case T_Boolean: + val = BoolGetDatum(boolVal(&aconst->val)); + + typeid = BOOLOID; + typelen = 1; + typebyval = true; + break; + case T_String: /* |