Skip to content

Grant permission to roles to create table on public schema#100

Merged
Sfurti-yb merged 1 commit intomasterfrom
grant-create-permission
Feb 10, 2025
Merged

Grant permission to roles to create table on public schema#100
Sfurti-yb merged 1 commit intomasterfrom
grant-create-permission

Conversation

@Sfurti-yb
Copy link
Contributor

PG15 changed the permissions and revokes the CREATE permission from all users except a database owner from the public (or default) schema. This reults in the error: ERROR: permission denied for schema public while creating a table from the app when the user is not postgres or yugabyte.

This change is to grant the user create permissions from the app itself.

Testing:
To test, create a new role on your cluster:

create role admin login password 'admin';

Run the yb-sample-apps and it should not give any error during create table

@Sfurti-yb Sfurti-yb self-assigned this Feb 6, 2025
@Sfurti-yb Sfurti-yb merged commit 1086f01 into master Feb 10, 2025
1 check failed
sridhar-imply pushed a commit that referenced this pull request Feb 13, 2025
String connectStr = String.format("%s//%s:%d/%s", url, contactPoint.getHost(),
contactPoint.getPort(),
database);
if (!username.equalsIgnoreCase("yugabyte") || !username.equalsIgnoreCase("postgres")){
Copy link
Contributor

Choose a reason for hiding this comment

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

Missed this in the review: The condition should be AND and not OR here. Please correct this with another PR

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.

2 participants