Did we intend to change whether PUBLIC can create tables in the public schema by default? - Mailing list pgsql-hackers

From David G. Johnston
Subject Did we intend to change whether PUBLIC can create tables in the public schema by default?
Date
Msg-id CAKFQuwai+y40XzzMhDsz8ctY86Csa+r-N+JeMOOKVXViYk8upg@mail.gmail.com
Whole thread Raw
Responses Re: Did we intend to change whether PUBLIC can create tables in the public schema by default?
List pgsql-hackers
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.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Atomic GetFreeIndexPage()?
Next
From: "David G. Johnston"
Date:
Subject: Re: Did we intend to change whether PUBLIC can create tables in the public schema by default?