Skip site navigation (1) Skip section navigation (2)

Re: pg_restore ignores PGDATABASE

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_restore ignores PGDATABASE
Date: 2012-02-19 13:02:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Sun, Feb 19, 2012 at 1:18 AM, Erik Rijkers <er(at)xs4all(dot)nl> wrote:
> On Sun, February 19, 2012 06:27, Robert Haas wrote:
>> On Sat, Feb 18, 2012 at 11:58 AM, Erik Rijkers <er(at)xs4all(dot)nl> wrote:
>>> pg_restore ignores environment variable PGDATABASE.
>> What exactly do you mean by "ignores"?  pg_restore prints results to
>> standard output unless a database name is specified.  AFAIK, there's
>> no syntax to say "I want a direct-to-database restore to whatever you
>> think the default database is".
> That's right, and that seems contradictory with:
> "This utility [pg_restore], like most other PostgreSQL utilities, also uses the environment
> variables supported by libpq (see Section 31.13)."
> as pg_restore does 'ignore' (for want of a better word) PGDATABASE.
> But I think I can conclude from your reply that that behaviour is indeed intentional.

It is, because we want there to be a way of converting a custom or tar
format archive back to text.  I think that probably works out for the
best anyway, since pg_restore is a sufficiently dangerous operation
that you want to be darn sure you're not doing it on the wrong
database.  dropdb also requires a database name, while createdb does
not, for similar reasons...

Robert Haas
The Enterprise PostgreSQL Company

In response to


pgsql-hackers by date

Next:From: Euler Taveira de OliveiraDate: 2012-02-19 14:46:33
Subject: Re: wal_buffers
Previous:From: Peter EisentrautDate: 2012-02-19 11:13:10
Subject: pg_upgrade --logfile option documentation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group