Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> writes:
> perform pg_catalog.set_config('search_path', templ, true);
> ...
> select count(distinct transaction_id) from public.transaction_condition
> into temp_count;
> raise notice '% remaining transactions in public!', temp_count;
> select count(distinct transaction_id) from transaction_condition into
> temp_count;
If this is inside a plpgsql function that's been executed more than
once, the SELECTs would have plans that were cached the first time
around, so that what would matter is the search_path that prevailed
during the first execution. There have been discussions about changing
that but we wouldn't treat it as a back-patchable bug fix, because
it would almost certainly break things for somebody.
regards, tom lane