summaryrefslogtreecommitdiff
path: root/src/backend/nodes/copyfuncs.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-01-14 10:46:49 +0100
committerPeter Eisentraut <peter@eisentraut.org>2022-01-17 10:38:23 +0100
commit941460fcf731a32e6a90691508d5cfa3d1f8eeaf (patch)
tree2de0be4abcf7db131607ce9ba590a8040c16d6e3 /src/backend/nodes/copyfuncs.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 <pavel.stehule@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/8c1a2e37-c68d-703c-5a83-7a6077f4f997@enterprisedb.com
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r--src/backend/nodes/copyfuncs.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index b105c263810..90b5da51c95 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -2750,6 +2750,9 @@ _copyA_Const(const A_Const *from)
case T_Float:
COPY_STRING_FIELD(val.fval.fval);
break;
+ case T_Boolean:
+ COPY_SCALAR_FIELD(val.boolval.boolval);
+ break;
case T_String:
COPY_STRING_FIELD(val.sval.sval);
break;
@@ -4949,6 +4952,16 @@ _copyFloat(const Float *from)
return newnode;
}
+static Boolean *
+_copyBoolean(const Boolean *from)
+{
+ Boolean *newnode = makeNode(Boolean);
+
+ COPY_SCALAR_FIELD(boolval);
+
+ return newnode;
+}
+
static String *
_copyString(const String *from)
{
@@ -5356,6 +5369,9 @@ copyObjectImpl(const void *from)
case T_Float:
retval = _copyFloat(from);
break;
+ case T_Boolean:
+ retval = _copyBoolean(from);
+ break;
case T_String:
retval = _copyString(from);
break;