mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user