pg_temp implicit search path: functions vs. tables

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: pg_temp implicit search path: functions vs. tables
Date: 2010-10-21 03:36:45
Message-ID: AANLkTimU831+prvm=qw+AJ3aPdVp7LwDgTcAz4mDyVcm@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I notice slightly different handling of the implicit search_path for
temporary tables and temporary functions. Consider:

(with a default search path):

# SHOW search_path;
search_path
----------------
"$user",public
(1 row)

BEGIN;
CREATE TABLE pg_temp.bar();

CREATE FUNCTION pg_temp.foofunc() RETURNS int AS $$
SELECT 1;
$$ LANGUAGE SQL;

SELECT * FROM bar;
SELECT * FROM foofunc();

COMMIT;

The select from temporary table bar above succeeds, but I get:
ERROR: function foofunc() does not exist

if I don't schema-qualify the function as pg_temp.foofunc(). So,
pg_temp is being implicitly included in the default search path when
looking for tables, but not for functions. Is there a reason for this
difference?

Josh

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Uckun 2010-10-21 03:44:01 Re: Updates, deletes and inserts are very slow. What can I do make them bearable?
Previous Message Greg Smith 2010-10-21 03:17:00 Re: Updates, deletes and inserts are very slow. What can I do make them bearable?