Postgresql error - must be owner of relation

If you get a Postgresql error message like this:

ERROR:  must be owner of relation [your_table_here]

don't worry too much, it probably means what it says: You don't own the table (or relation) you're trying to modify. Well, I guess you can worry if you can't get someone to fix the permissions, but if you can it's no big deal.

I just had the problem trying to run some ALTER TABLE statements, and it turns out the Postgres user I logged in as didn't own the tables I was trying to modify. I sent an email to the database administrator, told him what the problem was, and he fixed the permissions. After that my ALTER TABLE commands worked just fine.

If it helps you can look at the tables in your database by running this command from the Postgresql command line:

\d

That's the Postgresql describe command, and it will show you something like this:

                  List of relations
 Schema |          Name           |   Type   | Owner  
--------+-------------------------+----------+--------
 public | blogs                   | table    | al
 public | users                   | table    | postgres

In my case, I got this Postgres error message when I was logged in as the Postgres user "al", and I was trying to modify the table named "users", which was owned by the Postgres user named "postgres". Once the database administrator changed that table to be owned by "al" my ALTER TABLE statement worked fine.

 

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.