1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-19 23:22:23 +03:00

Improve style of two code paths

In execGrouping.c, execTuplesMatchPrepare() was doing a memory
allocation that was not necessary when the number of columns was 0.
In foreign.c, pg_options_to_table() was assigning twice a variable to
the same value.

Author: Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAqup0agbSzMjSLSTn=OANyCzxENF1+HrSYnr3WyZib7=Q@mail.gmail.com
This commit is contained in:
Michael Paquier
2024-10-08 10:51:20 +09:00
parent a9ed7d9449
commit 4572d59e3c
2 changed files with 4 additions and 2 deletions

View File

@@ -62,13 +62,15 @@ execTuplesMatchPrepare(TupleDesc desc,
const Oid *collations, const Oid *collations,
PlanState *parent) PlanState *parent)
{ {
Oid *eqFunctions = (Oid *) palloc(numCols * sizeof(Oid)); Oid *eqFunctions;
int i; int i;
ExprState *expr; ExprState *expr;
if (numCols == 0) if (numCols == 0)
return NULL; return NULL;
eqFunctions = (Oid *) palloc(numCols * sizeof(Oid));
/* lookup equality functions */ /* lookup equality functions */
for (i = 0; i < numCols; i++) for (i = 0; i < numCols; i++)
eqFunctions[i] = get_opcode(eqOperators[i]); eqFunctions[i] = get_opcode(eqOperators[i]);

View File

@@ -524,7 +524,7 @@ pg_options_to_table(PG_FUNCTION_ARGS)
Datum array = PG_GETARG_DATUM(0); Datum array = PG_GETARG_DATUM(0);
ListCell *cell; ListCell *cell;
List *options; List *options;
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; ReturnSetInfo *rsinfo;
options = untransformRelOptions(array); options = untransformRelOptions(array);
rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;