From: Ben Morrow <ben@morrow.me.uk>
To: pgsql-sql@postgresql.org
Subject: Casts in foreign schemas
Date: Tue, 8 Jun 2010 15:33:27 +0100
Message-ID: <20100608143327.GA67823@osiris.mauzo.dyndns.org> (raw)
Is this behaviour expected? (This is with 8.4.3 on FreeBSD.)
create schema one;
set search_path to one;
create type foo as (x integer);
create function foo (integer) returns foo
language plpgsql as $$
declare
y foo;
begin
y.x = $1;
return y;
end
$$;
create cast (integer as foo) with function foo (integer);
grant usage on schema one to public;
grant execute on function foo (integer) to public;
create schema two;
-- reconnect as a different user
set search_path to two;
select 3::one.foo;
ERROR: type "foo" does not exist
CONTEXT: compilation of PL/pgSQL function "foo" near line 2
set search_path to two, one;
select 3::foo;
foo
-----
(3)
(1 row)
My understanding of things was that PL/pgSQL functions were compiled at
CREATE FUNCTION time, using the SEARCH_PATH currently in effect. Is that
wrong? Is there some GRANT I'm missing that will make this work?
Ben
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ben@morrow.me.uk
Subject: Re: Casts in foreign schemas
In-Reply-To: <20100608143327.GA67823@osiris.mauzo.dyndns.org>
* 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