diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-01-14 10:46:49 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-01-17 10:38:23 +0100 |
commit | 941460fcf731a32e6a90691508d5cfa3d1f8eeaf (patch) | |
tree | 2de0be4abcf7db131607ce9ba590a8040c16d6e3 /src/backend/commands/tsearchcmds.c | |
parent | ca86a63d207aca1f52ff13a1ce13854681d1bbf9 (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/commands/tsearchcmds.c')
-rw-r--r-- | src/backend/commands/tsearchcmds.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c index 39f0bf7a0d4..4cc4e3c00f8 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -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), |