summaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.c
diff options
context:
space:
mode:
authorPeter Eisentraut2022-01-14 09:46:49 +0000
committerPeter Eisentraut2022-01-17 09:38:23 +0000
commit941460fcf731a32e6a90691508d5cfa3d1f8eeaf (patch)
tree2de0be4abcf7db131607ce9ba590a8040c16d6e3 /src/backend/nodes/outfuncs.c
parentca86a63d207aca1f52ff13a1ce13854681d1bbf9 (diff)
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 <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/[email protected]
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index d28cea15670..2b0236937aa 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -3435,6 +3435,12 @@ _outFloat(StringInfo str, const Float *node)
}
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))