public inbox for [email protected]  
help / color / mirror / Atom feed
Table owner change issue
3+ messages / 3 participants
[nested] [flat]

* Table owner change issue
@ 2024-11-21 20:42  Benjamin Patrick <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: Benjamin Patrick @ 2024-11-21 20:42 UTC (permalink / raw)
  To: [email protected] <[email protected]>

I am using PGAdmin 4.8.8.  New to the group and hoping this the correct group for assistance.
My instance is an AWS instance so there isn't a viable superuser.
I had a user create table with the table owner being themself.  user.schema.tablename
I wanted to change the owner to the dbowner, but was unable in pgadmin or script. dbowner.schema.tablename
I had the user run a script to the change the table owner to the dbowner but the user received an error unable to set role.  This occurred both in script and pgadmin.

The table owner was able to change to a mutual role that both the user and the dbowner are members.  From there the dbowner was still unable to change the table owner to the dbowner.

Any assistance would be super helpful.






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Table owner change issue
@ 2024-11-21 20:54  Holger Jakobs <[email protected]>
  parent: Benjamin Patrick <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Holger Jakobs @ 2024-11-21 20:54 UTC (permalink / raw)
  To: [email protected]

Am 21.11.24 um 21:42 schrieb Benjamin Patrick:
> I am using PGAdmin 4.8.8.  New to the group and hoping this the 
> correct group for assistance.
> My instance is an AWS instance so there isn't a viable superuser.
> I had a user create table with the table owner being themself. 
> user.schema.tablename
> I wanted to change the owner to the dbowner, but was unable in pgadmin 
> or script. dbowner.schema.tablename
> I had the user run a script to the change the table owner to the 
> dbowner but the user received an error unable to set role.  This 
> occurred both in script and pgadmin.
>
> The table owner was able to change to a mutual role that both the user 
> and the dbowner are members.  From there the dbowner was still unable 
> to change the table owner to the dbowner.
>
> Any assistance would be super helpful.
>
>
Actually, PGAdmin problems should be discussed on the mailing list of 
PGAdmin.


But since the question isn't related to PGAdmin, but rather PostgreSQL 
server, I can give an answer here.


Some hints:

  * Include the server version, at least the major version. Current is 17.1.
  * Include the commands you have tried. Don't type them, copy them!
  * Include all messages you get from the server.
  * If something doesn't work in PGAdmin, always try again using psql,
    because this is the only frontend maintained by the PostgreSQL
    developers.

It's not possible to change ownership of an object (table, view, schema, 
function, ...) to a role you aren't a member of. Otherwise, you might 
change it and lock yourself out.


And of course, you have to be owner of an object to alter it. Unless you 
are a superuser.


Kind Regards,


Holger


-- 

Holger Jakobs, Bergisch Gladbach



Attachments:

  [application/pgp-signature] OpenPGP_signature (203B, 3-OpenPGP_signature)
  download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Table owner change issue
@ 2024-11-21 22:12  Laurenz Albe <[email protected]>
  parent: Benjamin Patrick <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Laurenz Albe @ 2024-11-21 22:12 UTC (permalink / raw)
  To: Benjamin Patrick <[email protected]>; [email protected] <[email protected]>

On Thu, 2024-11-21 at 20:42 +0000, Benjamin Patrick wrote:
> I am using PGAdmin 4.8.8.  New to the group and hoping this the correct group for assistance.
> My instance is an AWS instance so there isn't a viable superuser.
> I had a user create table with the table owner being themself.  user.schema.tablename
> I wanted to change the owner to the dbowner, but was unable in pgadmin or script. dbowner.schema.tablename

See the documentation: https://www.postgresql.org/docs/current/sql-altertable.html

  "To alter the owner, you must be able to SET ROLE to the new owning role,
  and that role must have CREATE privilege on the table's schema."

Yours,
Laurenz Albe






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-11-21 22:12 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-11-21 20:42 Table owner change issue Benjamin Patrick <[email protected]>
2024-11-21 20:54 ` Holger Jakobs <[email protected]>
2024-11-21 22:12 ` Laurenz Albe <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox