ALTER .. OWNER TO error mislabels schema as other object type

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ALTER .. OWNER TO error mislabels schema as other object type
Date: 2012-12-20 16:38:03
Message-ID: CA+TgmoZxG8V+app_Hy6haupBXQX9VkJE_M0eLVfNMeEa7o3S5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2012-12-20 16:39:09 Re: Enabling Checksums
Previous Message Tom Lane 2012-12-20 16:33:40 Re: operator dependency of commutator and negator, redux