1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

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
This commit is contained in:
Peter Eisentraut
2022-01-14 10:46:49 +01:00
parent ca86a63d20
commit 941460fcf7
20 changed files with 211 additions and 128 deletions

View File

@ -3434,6 +3434,12 @@ _outFloat(StringInfo str, const Float *node)
appendStringInfoString(str, node->fval);
}
static void
_outBoolean(StringInfo str, const Boolean *node)
{
appendStringInfoString(str, node->boolval ? "true" : "false");
}
static void
_outString(StringInfo str, const String *node)
{
@ -3846,6 +3852,8 @@ outNode(StringInfo str, const void *obj)
_outInteger(str, (Integer *) obj);
else if (IsA(obj, Float))
_outFloat(str, (Float *) obj);
else if (IsA(obj, Boolean))
_outBoolean(str, (Boolean *) obj);
else if (IsA(obj, String))
_outString(str, (String *) obj);
else if (IsA(obj, BitString))