Thread: Did we intend to change whether PUBLIC can create tables in the public schema by default?
Did we intend to change whether PUBLIC can create tables in the public schema by default?
From
"David G. Johnston"
Date:
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)
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
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.
Re: Did we intend to change whether PUBLIC can create tables in the public schema by default?
From
"David G. Johnston"
Date:
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...
Sorry for the noise.
David J.