summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorÁlvaro Herrera2025-03-13 17:15:59 +0000
committerÁlvaro Herrera2025-03-13 17:15:59 +0000
commitc7fc8808a91ed1b5810abb5f6043be7b6d58dbcf (patch)
treef71b55289641daa173c23401aff7881977c04137 /src/backend/commands
parentda0f0582e81e2fc42e19feaece56364acfb3f640 (diff)
ATExecSetRelOptions: Reduce scope of 'isnull' variable
Author: Nikolay Shaplov <[email protected]> Reviewed-by: Timur Magomedov <[email protected]> Discussion: https://postgr.es/m/1913854.tdWV9SEqCh@thinkpad-pgpro
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/tablecmds.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 18ff8956577..d3edd879654 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -15919,7 +15919,6 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
HeapTuple tuple;
HeapTuple newtuple;
Datum datum;
- bool isnull;
Datum newOptions;
Datum repl_val[Natts_pg_class];
bool repl_null[Natts_pg_class];
@@ -15944,18 +15943,20 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
* there were none before.
*/
datum = (Datum) 0;
- isnull = true;
}
else
{
+ bool isnull;
+
/* Get the old reloptions */
datum = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
&isnull);
+ if (isnull)
+ datum = (Datum) 0;
}
/* Generate new proposed reloptions (text array) */
- newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
- defList, NULL, validnsps, false,
+ newOptions = transformRelOptions(datum, defList, NULL, validnsps, false,
operation == AT_ResetRelOptions);
/* Validate */
@@ -16065,18 +16066,20 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
* pretend there were none before.
*/
datum = (Datum) 0;
- isnull = true;
}
else
{
+ bool isnull;
+
/* Get the old reloptions */
datum = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
&isnull);
+ if (isnull)
+ datum = (Datum) 0;
}
- newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
- defList, "toast", validnsps, false,
- operation == AT_ResetRelOptions);
+ newOptions = transformRelOptions(datum, defList, "toast", validnsps,
+ false, operation == AT_ResetRelOptions);
(void) heap_reloptions(RELKIND_TOASTVALUE, newOptions, true);