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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Did we intend to change whether PUBLIC can create tables in the public schema by default?
Date: 2022-05-04 19:42:43
Message-ID: CAKFQuwai+y40XzzMhDsz8ctY86Csa+r-N+JeMOOKVXViYk8upg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-05-04 19:49:35 Re: Did we intend to change whether PUBLIC can create tables in the public schema by default?
Previous Message Tom Lane 2022-05-04 19:27:21 Re: Atomic GetFreeIndexPage()?