I didn't want to report the bug using the form before confirming it here.
Here is a gist of what I'm trying:
The relevant part being this:
old_path := pg_catalog.current_setting('search_path');
raise notice 'setting search_path from % to %', old_path, templ;
perform pg_catalog.set_config('search_path', templ, true);
select count(distinct transaction_id) from public.transaction_condition
raise notice '% remaining transactions in public!', temp_count;
select count(distinct transaction_id) from transaction_condition into
raise notice '% remaining transactions', temp_count;
For which I get this result (NOTA is Portuguese word for NOTE or NOTICE,
NOTA: setting search_path from "$user",public to public
NOTA: 1030 remaining transactions in public!
NOTA: 66 remaining transactions
Why do I get different results for both count() queries? The only
difference between them is that I made the schema explicit in the first
call but since current_path is set to "public" there shouldn't be any
By the way, 66 is the record count for stock.transaction_condition after
calling that function the first time for the stock schema.
I've tested the above using PG 9.2.2. Any ideas on what is happening?
Thanks in advance,