Skip to content

Commit c7fc880

Browse files
committed
ATExecSetRelOptions: Reduce scope of 'isnull' variable
Author: Nikolay Shaplov <dhyan@nataraj.su> Reviewed-by: Timur Magomedov <t.magomedov@postgrespro.ru> Discussion: https://postgr.es/m/1913854.tdWV9SEqCh@thinkpad-pgpro
1 parent da0f058 commit c7fc880

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/backend/commands/tablecmds.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15919,7 +15919,6 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1591915919
HeapTuple tuple;
1592015920
HeapTuple newtuple;
1592115921
Datum datum;
15922-
bool isnull;
1592315922
Datum newOptions;
1592415923
Datum repl_val[Natts_pg_class];
1592515924
bool repl_null[Natts_pg_class];
@@ -15944,18 +15943,20 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1594415943
* there were none before.
1594515944
*/
1594615945
datum = (Datum) 0;
15947-
isnull = true;
1594815946
}
1594915947
else
1595015948
{
15949+
bool isnull;
15950+
1595115951
/* Get the old reloptions */
1595215952
datum = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
1595315953
&isnull);
15954+
if (isnull)
15955+
datum = (Datum) 0;
1595415956
}
1595515957

1595615958
/* Generate new proposed reloptions (text array) */
15957-
newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
15958-
defList, NULL, validnsps, false,
15959+
newOptions = transformRelOptions(datum, defList, NULL, validnsps, false,
1595915960
operation == AT_ResetRelOptions);
1596015961

1596115962
/* Validate */
@@ -16065,18 +16066,20 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1606516066
* pretend there were none before.
1606616067
*/
1606716068
datum = (Datum) 0;
16068-
isnull = true;
1606916069
}
1607016070
else
1607116071
{
16072+
bool isnull;
16073+
1607216074
/* Get the old reloptions */
1607316075
datum = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions,
1607416076
&isnull);
16077+
if (isnull)
16078+
datum = (Datum) 0;
1607516079
}
1607616080

16077-
newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
16078-
defList, "toast", validnsps, false,
16079-
operation == AT_ResetRelOptions);
16081+
newOptions = transformRelOptions(datum, defList, "toast", validnsps,
16082+
false, operation == AT_ResetRelOptions);
1608016083

1608116084
(void) heap_reloptions(RELKIND_TOASTVALUE, newOptions, true);
1608216085

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy