ALTER .. OWNER TO error mislabels schema as other object type - Mailing list pgsql-hackers

From Robert Haas
Subject ALTER .. OWNER TO error mislabels schema as other object type
Date
Msg-id CA+TgmoZxG8V+app_Hy6haupBXQX9VkJE_M0eLVfNMeEa7o3S5Q@mail.gmail.com
Whole thread Raw
Responses Re: ALTER .. OWNER TO error mislabels schema as other object type  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: ALTER .. OWNER TO error mislabels schema as other object type  (Kohei KaiGai <kaigai@kaigai.gr.jp>)
List pgsql-hackers
This looks busted:

rhaas=# create role clerks;
CREATE ROLE
rhaas=# create role bob in role clerks;
CREATE ROLE
rhaas=# create schema foo;
CREATE SCHEMA
rhaas=# grant usage on schema foo to bob, clerks;
GRANT
rhaas=# create aggregate
foo.sum(basetype=text,sfunc=textcat,stype=text,initcond='');
CREATE AGGREGATE
rhaas=# alter aggregate foo.sum(text) owner to bob;
ALTER AGGREGATE
rhaas=# set role bob;
SET
rhaas=> alter aggregate foo.sum(text) owner to clerks;
ERROR:  permission denied for function foo

Eh?  There's no function called foo.  There's a schema called foo,
which seems to be the real problem: clerks needs to have CREATE on foo
in order for bob to complete the rename.  But somehow the error
message is confused about what type of object it's dealing with.

[ Credit: The above example is adapted from an EDB-internal regression
test, the failure of which was what alerted me to this problem. ]

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: operator dependency of commutator and negator, redux
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Enabling Checksums