Re: Permissions pg_dump / import

From: "Ilya Kazakevich" <Ilya(dot)Kazakevich(at)JetBrains(dot)com>
To: "'Patrick B'" <patrickbakerbr(at)gmail(dot)com>, "'pgsql-general'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Permissions pg_dump / import
Date: 2016-08-17 22:30:47
Message-ID: 000901d1f8d7$0099edc0$01cdc940$@JetBrains.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> Owned by: public.accounts.id

This is not owner but table this sequence depends on. See http://stackoverflow.com/questions/6941043/get-table-and-column-owning-a-sequence

Use query provided on SO to get real owner

Ilya Kazakevich

JetBrains

http://www.jetbrains.com <http://www.jetbrains.com/>

The Drive to Develop

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Patrick B
Sent: Thursday, August 18, 2016 1:17 AM
To: pgsql-general
Subject: [GENERAL] Permissions pg_dump / import

Hi guys,

I'm running a pg_dump and then importing the dump into a test server. I'm using PostgreSQL 9.5.

pg_dump:

pg_dump --dbname=prod1 --host= servername --port=5432 --username=user1 -v -f test1_NEW.sql

Steps into the new database (test1):

CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO user1;
psql -h servername -U master --port=5432 --dbname=test1 -f test1_NEW.sql

I get lots of errors like:

psql:test1_NEW.sql:212: ERROR: must be owner of relation accounts_id_seq

prod1=> \d+ accounts_id_seq
Sequence "public.accounts_id_seq"
Column | Type | Value | Storage
---------------+---------+---------------------+---------
sequence_name | name | accounts_id_seq | plain
last_value | bigint | 33 | plain
start_value | bigint | 1 | plain
increment_by | bigint | 1 | plain
max_value | bigint | 9223372036854775807 | plain
min_value | bigint | 1 | plain
cache_value | bigint | 1 | plain
log_cnt | bigint | 32 | plain
is_cycled | boolean | f | plain
is_called | boolean | t | plain
Owned by: public.accounts.id

What do I have to do? Should I revoke the permissions on the prod1 database before performing the dump?

Cheers;

Patrick

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Branden Visser 2016-08-17 22:58:34 Re: Re: Easiest way to compare the results of two queries row by row and column by column
Previous Message Steve Crawford 2016-08-17 22:30:09 Re: Permissions pg_dump / import