pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: wrong search_path being used
Date: Mon, 07 Jan 2013 16:50:17 -0200
Message-ID: <50EB18E9.8020202@gmail.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

I didn't want to report the bug using the form before confirming it here.

Here is a gist of what I'm trying:

https://gist.github.com/49fcc8c4a5a810f66833#file-cleanup-sql

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 
into temp_count;

raise notice '% remaining transactions in public!', temp_count;

select count(distinct transaction_id) from transaction_condition into 
temp_count;

raise notice '% remaining transactions', temp_count;



For which I get this result (NOTA is Portuguese word for NOTE or NOTICE, 
not sure...):

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 
difference, right?

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,
Rodrigo.

view thread (15+ messages)  latest in thread

Message-ID: <50EB18E9.8020202@gmail.com>
Permalink:  ../50EB18E9.8020202@gmail.com/
Also on:    postgresql.org/message-id/50EB18E9.8020202@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: rr.rosas@gmail.com
  Subject: Re: wrong search_path being used
  In-Reply-To: <50EB18E9.8020202@gmail.com>
  References: <50EB18E9.8020202@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox