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

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

Merged
merged 1 commit into from
Feb 10, 2025

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-yb pushed a commit that referenced this pull request Feb 13, 2025
@@ -212,6 +212,15 @@ protected Connection getPostgresConnection(String database, String username, Str
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