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:
@ -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))
|
||||
|
Reference in New Issue
Block a user