pg_temp implicit search path: functions vs. tables - Mailing list pgsql-general

From Josh Kupershmidt
Subject pg_temp implicit search path: functions vs. tables
Date
Msg-id AANLkTimU831+prvm=qw+AJ3aPdVp7LwDgTcAz4mDyVcm@mail.gmail.com
Whole thread Raw
Responses Re: pg_temp implicit search path: functions vs. tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: Updates, deletes and inserts are very slow. What can I do make them bearable?
Next
From: Tim Uckun
Date:
Subject: Re: Updates, deletes and inserts are very slow. What can I do make them bearable?