mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +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:
@@ -1742,6 +1742,15 @@ buildDefItem(const char *name, const char *val, bool was_quoted)
|
||||
return makeDefElem(pstrdup(name),
|
||||
(Node *) makeFloat(pstrdup(val)),
|
||||
-1);
|
||||
|
||||
if (strcmp(val, "true") == 0)
|
||||
return makeDefElem(pstrdup(name),
|
||||
(Node *) makeBoolean(true),
|
||||
-1);
|
||||
if (strcmp(val, "false") == 0)
|
||||
return makeDefElem(pstrdup(name),
|
||||
(Node *) makeBoolean(false),
|
||||
-1);
|
||||
}
|
||||
/* Just make it a string */
|
||||
return makeDefElem(pstrdup(name),
|
||||
|
Reference in New Issue
Block a user