CREATE TABLE LIKE INCLUDING PRIVILEGES - Mailing list pgsql-hackers

From jian he
Subject CREATE TABLE LIKE INCLUDING PRIVILEGES
Date
Msg-id CACJufxGWuBzcF+t0K0Urs6A=ThdFr3pWMw+EANjKNoB=hBw5Rw@mail.gmail.com
Whole thread
Responses Re: CREATE TABLE LIKE INCLUDING PRIVILEGES
List pgsql-hackers
Hi,

Inspired by this message [1], introduce CREATE TABLE LIKE INCLUDING PRIVILEGES.
With this, the source table ACL stored in pg_class.relacl and
pg_attribute.attacl will now be copied to the target table.
This functionality only works if the current user is also the owner of
the source table.

Demo:
CREATE ROLE alice;
CREATE ROLE bob;
SET ROLE alice;
CREATE TABLE src (a int, b int);
GRANT INSERT ON src TO bob WITH GRANT OPTION;
CREATE TABLE dst (LIKE src INCLUDING PRIVILEGES);
SELECT relacl FROM pg_class WHERE relname = 'dst';
               relacl
-------------------------------------
 {alice=arwdDxtm/alice,bob=a*/alice}

[1]: https://www.postgresql.org/message-id/546590.1771005826%40sss.pgh.pa.us



--
jian
https://www.enterprisedb.com/

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [PATCH] doc: Document that invalid indexes are skipped during ATTACH PARTITION
Next
From: Fujii Masao
Date:
Subject: Re: Fix regression in vacuumdb --analyze-in-stages for partitioned tables