Gavin Sherry <swm@linuxworld.com.au> writes:
> Chris KL just raised an issue on IRC:
> test=> create table test (a int4) tablespace pg_default;
> ERROR: permission denied for tablespace pg_default
This is not a bug. If you don't have tablespace permissions, you don't
get to specify where your table goes --- it gets put into the tablespace
that is default for your schema or database. Which is not necessarily
pg_default.
You could possibly argue that pg_default ought to have world permissions
in the default setup, but I don't really see why. Joe User probably
shouldn't be fooling with tablespaces at all.
> I guess that might have been a bit presumptuous but a similar thing
> happens if you don't specify a tablespace:
> tablespaceId = get_namespace_tablespace(namespaceId);
> /* note no permission check on tablespace in this case */
That's not a bug either. The presumption is that whoever assigned a
default tablespace to your schema or database had the right to do so.
Users who just make use of that default don't need any extra
permissions.
regards, tom lane