Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3de4914

Browse files
committed
Simplify null-element handling in extension_config_remove().
There's no point in asking deconstruct_array() for a null-flags array when we already checked the array has no nulls, and aren't going to examine the output anyhow. Not asking for this output should make the code marginally faster, and it's also more robust since if there somehow were nulls, deconstruct_array() would throw an error. Daniel Gustafsson Discussion: https://postgr.es/m/289FFB8B-7AAB-48B5-A497-6E0D41D7BA47@yesql.se
1 parent e3f005d commit 3de4914

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/backend/commands/extension.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,14 +2597,13 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
25972597
{
25982598
/* squeeze out the target element */
25992599
Datum *dvalues;
2600-
bool *dnulls;
26012600
int nelems;
26022601
int i;
26032602

2603+
/* We already checked there are no nulls */
26042604
deconstruct_array(a, OIDOID, sizeof(Oid), true, 'i',
2605-
&dvalues, &dnulls, &nelems);
2605+
&dvalues, NULL, &nelems);
26062606

2607-
/* We already checked there are no nulls, so ignore dnulls */
26082607
for (i = arrayIndex; i < arrayLength - 1; i++)
26092608
dvalues[i] = dvalues[i + 1];
26102609

@@ -2644,14 +2643,13 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
26442643
{
26452644
/* squeeze out the target element */
26462645
Datum *dvalues;
2647-
bool *dnulls;
26482646
int nelems;
26492647
int i;
26502648

2649+
/* We already checked there are no nulls */
26512650
deconstruct_array(a, TEXTOID, -1, false, 'i',
2652-
&dvalues, &dnulls, &nelems);
2651+
&dvalues, NULL, &nelems);
26532652

2654-
/* We already checked there are no nulls, so ignore dnulls */
26552653
for (i = arrayIndex; i < arrayLength - 1; i++)
26562654
dvalues[i] = dvalues[i + 1];
26572655

0 commit comments

Comments
 (0)