Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: populate pg_catalog.pg_default_acl table #67872

Merged
merged 1 commit into from
Jul 23, 2021

Conversation

RichardJCai
Copy link
Contributor

@RichardJCai RichardJCai commented Jul 21, 2021

Release note (sql change): Populate pg_catalog.pg_default_acl.
This is important for tracking which default privileges are defined
in the database.

pg_catalog.pg_default_acl has 5 columns.
oid oid - row identifier
defaclrole oid - oid of the role the default privileges are defined for
defaclnamespace oid - oid of the schema the default privileges are defined in
defaclobjtype char - r = relation (table, view), S = sequence, f = function, T = type, n = schema
defaclacl aclitem[] - string representation of default privileges, following the format
"$1=$2/$3" where $1 is the grantee's username, $2 is a list of characters representing
the privileges and $3 is the grantor (which is currently always an empty string in CRDB).

Privileges are represented by chars in the aclitem[] representation.
CREATE = 'C'
SELECT = 'r'
INSERT = 'a'
DELETE = 'd'
UPDATE = 'w'
USAGE = 'U'
CONNECT = 'c'

See: https://www.postgresql.org/docs/current/ddl-priv.html#PRIVILEGES-SUMMARY-TABLE
for the table of Postgres supported privileges and their char representations.

See: https://www.postgresql.org/docs/13/catalog-pg-default-acl.html for postgres' definition
of pg_catalog.pg_default_acl.

@RichardJCai RichardJCai requested review from rafiss, arulajmani, a team and adityamaru and removed request for a team July 21, 2021 19:15
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RichardJCai RichardJCai force-pushed the pg_default_acl_07202021 branch 2 times, most recently from fe5396d to 338af01 Compare July 21, 2021 19:38
pkg/sql/pg_catalog.go Outdated Show resolved Hide resolved
pkg/sql/pg_catalog.go Outdated Show resolved Hide resolved
pkg/sql/pg_catalog.go Outdated Show resolved Hide resolved
pkg/sql/pg_catalog.go Show resolved Hide resolved
pkg/sql/privilege/privilege.go Outdated Show resolved Hide resolved
@RichardJCai RichardJCai force-pushed the pg_default_acl_07202021 branch 2 times, most recently from 2ac3170 to 6b9ebe8 Compare July 22, 2021 14:46
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Release note (sql change): Populate pg_catalog.pg_default_acl.
This is important for tracking which default privileges are defined
in the database.

pg_catalog.pg_default_acl has 5 columns.
oid oid - row identifier
defaclrole oid - oid of the role the default privileges are defined for
defaclnamespace oid - oid of the schema the default privileges are defined in
defaclobjtype char - r = relation (table, view), S = sequence, f = function, T = type, n = schema
defaclacl aclitem[] - string representation of default privileges, following the format
    "$1=$2/$3" where $1 is the grantee's username, $2 is a list of characters representing
    the privileges and $3 is the grantor (which is currently always an empty string in CRDB).

Privileges are represented by chars in the aclitem[] representation.
CREATE = 'C'
SELECT = 'r'
INSERT = 'a'
DELETE = 'd'
UPDATE = 'w'
USAGE = 'U'
CONNECT = 'c'

See: https://www.postgresql.org/docs/current/ddl-priv.html#PRIVILEGES-SUMMARY-TABLE
for the table of Postgres supported privileges and their char representations.

See: https://www.postgresql.org/docs/13/catalog-pg-default-acl.html for postgres' definition
of pg_catalog.pg_default_acl.
@RichardJCai
Copy link
Contributor Author

bors r=rafiss

@craig
Copy link
Contributor

craig bot commented Jul 22, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jul 23, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jul 23, 2021

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants