Re:

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2015-11-15 14:36:17
Message-ID: 035401d11fb3$01432640$03c972c0$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

I never used pg_restore, but I assume that it works similarly to other PG tools, i.e. if you don’t specify a user to connect to the database it will take your unix user name. I assume that your step number 6 is the closing of the shell where you were as user postgres because after 5 you already are out of psql.

So the questions is, if you have a DB user alex with the Create privilege on the database icare.

If not you may try the following:

- Open a psql terminal (steps 1-3)

- CREATE ROLE alex LOGIN SUPERUSER PASSWORD '...';

And try the pg_restore again (steps 5-7).

You may also try to omit step 6 but then all you DB objects will be owned by postgres. If this is what you need it is fine.

Hope this helps.

Bye

Charles

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Alex Luya
Sent: Sonntag, 15. November 2015 14:44
To: Giuseppe Sacco <giuseppe(at)eppesuigoccas(dot)homedns(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL]

Ubuntu 14.04 64bit + postgresql 9.4 are used here;

What I have done are:

1,Sign In ubuntu by user alex

2,then:sudo -i -u postgres

3,then:psql jump into command client

4,then: create database icare;

5,then: \q jump out command client

6,then run: exit jump out psql

7,then pg_restore --clean --create --exit-on-error --dbname=icare icare-test.tar

On Fri, Nov 13, 2015 at 10:52 PM, Giuseppe Sacco <giuseppe(at)eppesuigoccas(dot)homedns(dot)org <mailto:giuseppe(at)eppesuigoccas(dot)homedns(dot)org> > wrote:

Hello,

Il giorno ven, 13/11/2015 alle 13.38 +0800, Alex Luya ha scritto:
> Hello,
> I created a new database by
> create database icare;
> then quit off psql and run:
> pg_restore --clean --create --exit-on-error --dbname=icare
> icare-test.tar
> it complains:
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 21; 2615
> 80924 SCHEMA icare icare
> pg_restore: [archiver (db)] could not execute query: ERROR:
> permission denied for database icare
> Command was: CREATE SCHEMA icare;

From what I understand, it means that the postgresql user that is
restoring the dump cannot create a schema on "icare" database. So, is
that user the same that issued che "create database" earlier? If it's
not, then you should grant all required priviledges to that user.

Bye,
Giuseppe

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org <mailto:pgsql-general(at)postgresql(dot)org> )
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

In response to

  • Re: at 2015-11-15 13:44:10 from Alex Luya

Responses

  • Re: at 2015-11-15 14:43:56 from Charles Clavadetscher

Browse pgsql-general by date

  From Date Subject
Next Message Charles Clavadetscher 2015-11-15 14:43:56 Re:
Previous Message Alex Luya 2015-11-15 13:44:10 Re: