From 941460fcf731a32e6a90691508d5cfa3d1f8eeaf Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 14 Jan 2022 10:46:49 +0100 Subject: 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 Discussion: https://www.postgresql.org/message-id/flat/8c1a2e37-c68d-703c-5a83-7a6077f4f997@enterprisedb.com --- src/backend/commands/functioncmds.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/backend/commands/functioncmds.c') diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 119b7959827..25b75375a8e 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -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), -- cgit v1.2.3