BUG #17534: 'tablespace' option crushes 'create database' query with 'permission denied' message - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17534: 'tablespace' option crushes 'create database' query with 'permission denied' message
Date
Msg-id 17534-fcb8fb4c81cd17b6@postgresql.org
Whole thread Raw
Responses Re: BUG #17534: 'tablespace' option crushes 'create database' query with 'permission denied' message
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17534
Logged by:          Nick Nalbantov
Email address:      akdmnnakdm@gmail.com
PostgreSQL version: 14.4
Operating system:   Windows
Description:

Here's an old problem (look at

https://dba.stackexchange.com/questions/204807/why-do-i-get-a-postgresql-permission-error-when-specifying-a-tablespace-in-the?rq=1),
but it's still reproducible in PG 15b1 on Windows and PG13 on Debian 10

If some user with createdb privilege would try to create database with
'tablespace = pg_default' option, query will fail with ERROR:  42501
But same query without  'tablespace = pg_default' option would work fine,
and new database will be created at pg_default tablespace as expected.

Steps to reproduce:

psql -U postgres -d postgres
create role test with login password '123' createdb;
\q

psql -U test -d postgres
\set VERBOSITY verbose
CREATE DATABASE test 
OWNER = test 
ENCODING = UTF8 
TABLESPACE = pg_default; -- query works as expected if this line is
missing

ERROR:  42501: permission denied for tablespace pg_default
LOCATION:  aclcheck_error, aclchk.c:3652


pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end
Next
From: David Johansen
Date:
Subject: Re: Auto-vacuum timing out and preventing connections