Re: Why does the pg_dumpall command have a database option?

From: Ray O'Donnell <ray(at)rodonnell(dot)ie>
To: Espresso Beanies <espressobeanies(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Why does the pg_dumpall command have a database option?
Date: 2019-06-21 13:38:43
Message-ID: 73413662-a5e6-d95d-872a-f69fc905628f@rodonnell.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 21/06/2019 14:32, Espresso Beanies wrote:
> Will it still dump all of the databases or just the one it connects to?
>
> On Thu, Jun 20, 2019 at 4:13 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
> <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>
> On 6/20/19 1:03 PM, Espresso Beanies wrote:
> > I'm trying to see if someone could answer to me why the pg_dumpall
> > command has a database option when it's designed to dump all the
> > databases in a PostgreSQL server instance. I'm only asking
> because when
> > I create a .pgpass file and try to use the pg_dumpall command,
> I'm still
> > required to specify a specific database even though the command
> itself
> > should be targeting all databases. Can anyone explain this to me
> a bit
> > better?
> >
> > Thanks,
>
> Because pg_dumpall is a client and needs to connect to a database to
> kick start the process/fetch global information:

It'll dump all the databases.

To expand on what Adrian said - PostgreSQL doesn't have a concept of
connecting just to the server - you always have to connect to a specific
database as well, no matter what you're actually doing. This is what the
"postgres" database is mostly used for.

HTH,

Ray.

--
Raymond O'Donnell // Galway // Ireland
ray(at)rodonnell(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rahul Chordiya 2019-06-21 13:42:28 got stuck in pglogical upgrade on FreeBSD
Previous Message Tom Lane 2019-06-21 13:36:32 Re: Index with new opclass not used for sorting