Possibly redundant context switch in postgres_fdw - Mailing list pgsql-hackers

From Ildar Musin
Subject Possibly redundant context switch in postgres_fdw
Date
Msg-id CAONYFtNX4cg7-tvwBsaatMYhJOPb6jrNs_p0=apm0_tjw9jQ6g@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi hackers,

ISTM that context switch in `create_cursor()`:

if (numParams > 0)
{
MemoryContext oldcontext;
oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
process_query_params(econtext,
fsstate->param_flinfo,
fsstate->param_exprs,
values);
MemoryContextSwitchTo(oldcontext);
}

is redundant since we should already be in `ecxt_per_tuple_memory` context according to `ForeignNext()`. Do I miss some hidden purpose? If not here is a patch that removes it.

Regards,
Ildar Musin
Attachment

pgsql-hackers by date:

Previous
From: Alexander Kuzmenkov
Date:
Subject: Re: Removing unneeded self joins
Next
From: Tom Lane
Date:
Subject: Re: PG vs macOS Mojave