1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +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:
Peter Eisentraut
2022-01-14 10:46:49 +01:00
parent ca86a63d20
commit 941460fcf7
20 changed files with 211 additions and 128 deletions

View File

@ -813,15 +813,15 @@ compute_function_attributes(ParseState *pstate,
if (transform_item)
*transform = transform_item->arg;
if (windowfunc_item)
*windowfunc_p = intVal(windowfunc_item->arg);
*windowfunc_p = boolVal(windowfunc_item->arg);
if (volatility_item)
*volatility_p = interpret_func_volatility(volatility_item);
if (strict_item)
*strict_p = intVal(strict_item->arg);
*strict_p = boolVal(strict_item->arg);
if (security_item)
*security_definer = intVal(security_item->arg);
*security_definer = boolVal(security_item->arg);
if (leakproof_item)
*leakproof_p = intVal(leakproof_item->arg);
*leakproof_p = boolVal(leakproof_item->arg);
if (set_items)
*proconfig = update_proconfig_value(NULL, set_items);
if (cost_item)
@ -1417,12 +1417,12 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
if (volatility_item)
procForm->provolatile = interpret_func_volatility(volatility_item);
if (strict_item)
procForm->proisstrict = intVal(strict_item->arg);
procForm->proisstrict = boolVal(strict_item->arg);
if (security_def_item)
procForm->prosecdef = intVal(security_def_item->arg);
procForm->prosecdef = boolVal(security_def_item->arg);
if (leakproof_item)
{
procForm->proleakproof = intVal(leakproof_item->arg);
procForm->proleakproof = boolVal(leakproof_item->arg);
if (procForm->proleakproof && !superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),