I'm trying to run:
pg_dump database_name > database_name_08_27_2018
but got these errors:
pg_dump: [archiver (db)] query failed: ERROR: permission denied for relation users_receipthash
pg_dump: [archiver (db)] query was: LOCK TABLE public.users_receipthash IN ACCESS SHARE MODE
How can I fix this? Ubuntu 16.04 server
lets assume you have table:
t=# create table users_receipthash();
CREATE TABLE
you either need to be owner of it:
t=# \dt users_receipthash
List of relations
Schema | Name | Type | Owner
--------+-------------------+-------+-------
public | users_receipthash | table | vao
(1 row)
or have owner role granted for you
t=# grant vao to root;
GRANT ROLE
or be a superuser:
t=# \du vao
List of roles
Role name | Attributes | Member of
-----------+------------+-----------------
vao | Superuser | {dba, PostgresRules}
if you not and you want to be one, run as sueruser
t=# alter user vao superuser;
ALTER ROLE
Now I use you referring to the db user you use connecting to database. You ommit -U key on connection string, thus I assume you use peer authentication for your os user. in my case I use os user vao (and db user vao )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With