Did we intend to change whether PUBLIC can create tables in the public schema by default?

Started by David G. Johnstonover 3 years ago2 messages
#1David G. Johnston
david.g.johnston@gmail.com

Hey,

For the following sequence of commands, on a newly initdb v15devel and
mostly clean v13 I get a failure and a created table respectively.

Showing v15devel:

postgres=# create database testdb;
CREATE DATABASE
postgres=# create role testrole;
CREATE ROLE
postgres=# \c testdb
You are now connected to database "testdb" as user "vagrant".
testdb=# set session authorization testrole;
SET
testdb=> create table public.testtable(id int);
ERROR: permission denied for schema public
LINE 1: create table public.testtable(id int);
testdb=> select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 15devel on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
(1 row)

=======================================================================================
v13.6 (I also have a report this is the behavior of v14)

postgres=# create database testdb;
crCREATE DATABASE
postgres=# create role testrole;
CREATE ROLE
postgres=# \c testdb
You are now connected to database "testdb" as user "postgres".
testdb=# select version();
version
----------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 13.6 (Ubuntu 13.6-1.pgdg20.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
(1 row)

testdb=# set session authorization testrole;
SET
testdb=> create table public.testtable (id int);
CREATE TABLE

David J.

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: David G. Johnston (#1)
Re: Did we intend to change whether PUBLIC can create tables in the public schema by default?

On Wed, May 4, 2022 at 12:42 PM David G. Johnston <
david.g.johnston@gmail.com> wrote:

Hey,

For the following sequence of commands, on a newly initdb v15devel and
mostly clean v13 I get a failure and a created table respectively.

Apparently I didn't search commit history well enough the first time...

https://github.com/postgres/postgres/commit/b073c3ccd06e4cb845e121387a43faa8c68a7b62

Sorry for the noise.

David J.