Thread:
Hello,I created a new database bycreate database icare;then quit off psql and run:pg_restore --clean --create --exit-on-error --dbname=icare icare-test.tarit complains:pg_restore: [archiver (db)] Error while PROCESSING TOC:pg_restore: [archiver (db)] Error from TOC entry 21; 2615 80924 SCHEMA icare icarepg_restore: [archiver (db)] could not execute query: ERROR: permission denied for database icareCommand was: CREATE SCHEMA icare;
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
http://www.postgresql.org/docs/9.2/interactive/app-pgrestore.html
Hello,I created a new database bycreate database icare;then quit off psql and run:pg_restore --clean --create --exit-on-error --dbname=icare icare-test.tarit complains:pg_restore: [archiver (db)] Error while PROCESSING TOC:pg_restore: [archiver (db)] Error from TOC entry 21; 2615 80924 SCHEMA icare icarepg_restore: [archiver (db)] could not execute query: ERROR: permission denied for database icareCommand was: CREATE SCHEMA icare;
--
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

On 11/12/2015 09:38 PM, Alex Luya wrote: > 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 Please show the pg_backup script that created icare-test.tar Also in the database you are dumping from, in psql, what is the output from: \l \dn > > 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; -- Adrian Klaver adrian.klaver@aklaver.com
On 11/13/2015 05:19 AM, Melvin Davidson wrote: > It is very simple. If you have already created database icare then > DO NOT use the -create flag! You can do that, you just cannot do that when the database you are connecting to, --dbname=icare, is the one you want to create. I use --dbname=postgres to connect to the system database postgres and have pg_restore then clean/create the intended database from there. In this case the database does not seem to be the issue. The problem is when pg_restore starts trying to create SCHEMA in the database. > > http://www.postgresql.org/docs/9.2/interactive/app-pgrestore.html > > And as requested before, please provide the O/S and PostgreSQL version. > > On Fri, Nov 13, 2015 at 12:38 AM, Alex Luya <alexander.luya@gmail.com > <mailto:alexander.luya@gmail.com>> wrote: > > 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; > > > > > -- > *Melvin Davidson* > I reserve the right to fantasize. Whether or not you > wish to share my fantasy is entirely up to you. -- Adrian Klaver adrian.klaver@aklaver.com
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
Hello,From what I understand, it means that the postgresql user that is
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;
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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/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@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Alex Luya
Sent: Sonntag, 15. November 2015 14:44
To: Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
Cc: pgsql-general@postgresql.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@eppesuigoccas.homedns.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Instead of creating a superuser you may simply grant the privilege on the database:
CREATE ROLE alex LOGIN PASSWORD '...';
GRANT CREATE ON DATABASE icare TO alex;
Bye
Charles
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Charles Clavadetscher
Sent: Sonntag, 15. November 2015 15:36
To: pgsql-general@postgresql.org
Subject: Re: [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@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Alex Luya
Sent: Sonntag, 15. November 2015 14:44
To: Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
Cc: pgsql-general@postgresql.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@eppesuigoccas.homedns.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On 11/15/2015 05:44 AM, Alex Luya wrote: > 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 Assuming -U postgres, correct? > > 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 Assuming -U alex, correct? So you CREATed the database as the user postgres. You then tried to pg_restore as user alex. The below says user alex does not have SCHEMA permissions on DATABASE icare. To be clear, system users are not automatically database users, they are two different universes, though your CREATE DATABASE worked as postgres is a database user name. A mapping can be set up between them, but that is not the default. What this means is you do not have to switch system users to do things in Postgres, you just need to specify -U(--username) to your Postgres commands. That argument can also come from an environment variable(PGUSER http://www.postgresql.org/docs/9.4/interactive/libpq-envars.html). In the absence of either a command line argument or an environment variable the system user name will be used, though this will only work if that name is also a database user name. So to get pass this problem when you do the pg_restore specify -U postgres: pg_restore --clean --create --exit-on-error --dbname=icare -U postgres icare-test.tar > > > On Fri, Nov 13, 2015 at 10:52 PM, Giuseppe Sacco > <giuseppe@eppesuigoccas.homedns.org > <mailto:giuseppe@eppesuigoccas.homedns.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@postgresql.org > <mailto:pgsql-general@postgresql.org>) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > > -- Adrian Klaver adrian.klaver@aklaver.com