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

Unable to grant schema level permissions to the user #56655

Closed
giorgimode opened this issue Nov 13, 2020 · 6 comments
Closed

Unable to grant schema level permissions to the user #56655

giorgimode opened this issue Nov 13, 2020 · 6 comments
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community

Comments

@giorgimode
Copy link

Describe the problem
GRANT ALL ON SCHEMA public TO max; fails with the following error

[42601] ERROR: at or near "public": syntax error Detail: source SQL: GRANT ALL ON SCHEMA public TO max
 ^ Hint: try \h GRANT

Please describe the issue you observed, and any steps we can take to reproduce it:
As described in the documentation, schema level grant can be applied via:
GRANT ALL ON SCHEMA cockroach_labs TO max;
In fact all schema related operations fail, e.g. SHOW GRANTS ON SCHEMA public;
I am using Postgresql driver version 42.2.18. CockroachDb cluster server version 19.1.11

To Reproduce

What did you do? Describe in your own words.
Connect to the CockroachDb cluster via Postgresql driver and run the commands above

Expected behavior
SHOW GRANTS ON SCHEMA public; -> you can view the list of grants
GRANT ALL ON SCHEMA public TO max; -> you can grant permissions to existing user max

Environment:

  • CockroachDB version 19.1.11
  • Server OS: MacOS Catalina 10.15.7
  • Client app: postgresql-42.2.18

Additional context
If I cannot grant schema level permissions, application fails to read data when a new table is created unless I give explicit permissions on the table. I have to run grant select,insert,delete,update on public.* to max; every time a new table is created

@blathers-crl
Copy link

blathers-crl bot commented Nov 13, 2020

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I have CC'd a few people who may be able to assist you:

  • @tim-o (member of the technical support engineering team)

If we have not gotten back to your issue within a few business days, you can try the following:

  • Join our community slack channel and ask on #cockroachdb.
  • Try find someone from here if you know they worked closely on the area and CC them.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community X-blathers-oncall labels Nov 13, 2020
@ajwerner
Copy link
Contributor

This is a real problem. The public schema is really just an alias for the database. Before 20.2, we didn't have user defined schemas but we just said that all tables were in the public schema. That means we have nothing to hang the privileges off of on the public schema.

We want to do the migration soon (21.1). In the meantime, you can either change the privileges on the database or convert the database to a schema or something like that.

@ajwerner
Copy link
Contributor

#55793 is the issue for the migration.

@giorgimode
Copy link
Author

Thanks for the update. When is 21.1 expected to be rolled out?

@ajwerner
Copy link
Contributor

Thanks for the update. When is 21.1 expected to be rolled out?

In the spring, probably April. Hope the workarounds are sufficient in the meantime.

@rafiss
Copy link
Collaborator

rafiss commented Dec 8, 2021

Unfortunately, we didn't get to this in 21.1, but we are now nearing completion on it and it will be in 22.1.

I'll close this in favor of #55793 and #67376

@rafiss rafiss closed this as completed Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. O-community Originated from the community
Projects
None yet
Development

No branches or pull requests

4 participants