I can't alter any table from Neon SQL Editor because I can't select the owner of this table
Hey Guys,
I have had a problem that has persisted for months now: when I create multiple roles using Neon UI, connect to the database using a specific role, and create a schema and tables using that role, I cannot modify that table with another user, and I can not create any table inside this schema.
When I try to change the owner of that schema, I will not be able to do that.
So, I need to be logged in with all the users who created schemas or tables to change multiple tables with various roles, which is painful. I also need to be able to change the owner of a schema and all its tables.
Also, when using the SQL editor in Neon, I cannot change the role from there directly. It stuck with one role, but I don't know which role.
I sent the support, and they told me that everything was working when I ran the change owner of the schema using queries, but that works only if I create the role using the schema owner that I want to change from the database.

4 Replies
other-emerald•2y ago
Can you provide a set of precise reproduction steps so we can better understand the issue? Are you unable to GRANT permissions to the various new users/roles?
quickest-silverOP•2y ago
Sure, these are the steps that you will follow to reproduce the issue.
1. Create two roles from Neon Console, for example,
user1 and user2
2. Login with any PostgreSQL Client, for example, Datagrip, using the first user user1
3. Create a new schema with the user1, for example dev schema
4. Create a new table in that schema Account
5. Try to change the owner of the schema or the table to user2 using alter table "dev"."Account" owner to user2;
this should produce this error ERROR: must be member of role "user2"
I appreciate your expertise in this matter and hope that you can assist. If you require any additional information, please don't hesitate to let me know. Thank you for your help.other-emerald•2y ago
OK, so when running these commands I received the error:
This is tricky. What I found is that the users created in the Neon Console (using the Roles UI) are superusers. This made things tricky with assigning grants/roles. Bear in mind I'm not a Postgres expert!
What I found worked is this. Login as
neondb_owner (or another superuser) and create non-super user roles:
Login as usera
Now you can run the ALTER TABLE "useraschema".accounts OWNER TO userb; command while logged in as usera. I'll ask internally about documentation and how to better handle this.quickest-silverOP•2y ago
Thanks @ShinyPokemon,
I will create only one user from the console, and the other users will be created with the first superuser.
I hope that you can find a solution for this issue when you create the user from the Neon UI console.