Commit 3de49148 authored by Tom Lane's avatar Tom Lane

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
parent e3f005d9
...@@ -2597,14 +2597,13 @@ extension_config_remove(Oid extensionoid, Oid tableoid) ...@@ -2597,14 +2597,13 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
{ {
/* squeeze out the target element */ /* squeeze out the target element */
Datum *dvalues; Datum *dvalues;
bool *dnulls;
int nelems; int nelems;
int i; int i;
/* We already checked there are no nulls */
deconstruct_array(a, OIDOID, sizeof(Oid), true, 'i', deconstruct_array(a, OIDOID, sizeof(Oid), true, 'i',
&dvalues, &dnulls, &nelems); &dvalues, NULL, &nelems);
/* We already checked there are no nulls, so ignore dnulls */
for (i = arrayIndex; i < arrayLength - 1; i++) for (i = arrayIndex; i < arrayLength - 1; i++)
dvalues[i] = dvalues[i + 1]; dvalues[i] = dvalues[i + 1];
...@@ -2644,14 +2643,13 @@ extension_config_remove(Oid extensionoid, Oid tableoid) ...@@ -2644,14 +2643,13 @@ extension_config_remove(Oid extensionoid, Oid tableoid)
{ {
/* squeeze out the target element */ /* squeeze out the target element */
Datum *dvalues; Datum *dvalues;
bool *dnulls;
int nelems; int nelems;
int i; int i;
/* We already checked there are no nulls */
deconstruct_array(a, TEXTOID, -1, false, 'i', deconstruct_array(a, TEXTOID, -1, false, 'i',
&dvalues, &dnulls, &nelems); &dvalues, NULL, &nelems);
/* We already checked there are no nulls, so ignore dnulls */
for (i = arrayIndex; i < arrayLength - 1; i++) for (i = arrayIndex; i < arrayLength - 1; i++)
dvalues[i] = dvalues[i + 1]; dvalues[i] = dvalues[i + 1];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment