pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Espresso Beanies <espressobeanies@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Why does the pg_dumpall command have a database option?
Date: Fri, 21 Jun 2019 06:51:14 -0700
Message-ID: <ff0673f6-95ac-1d8d-4b90-a9159eceecdc@aklaver.com> (raw)
In-Reply-To: <CAOeD1693QJ6AAT5CaG0u71D+uK3N-5GFGr1H1VnPMeeccrP9xw@mail.gmail.com>
References: <CAOeD169OQpnu8qn1PaSoOEg=h8SAviKZcMUnfNobbXtX26H_Ww@mail.gmail.com>
	<d2d0b615-7e9b-afbb-5892-33aa12167e1b@aklaver.com>
	<CAOeD1693QJ6AAT5CaG0u71D+uK3N-5GFGr1H1VnPMeeccrP9xw@mail.gmail.com>

On 6/21/19 6:32 AM, Espresso Beanies wrote:
> Will it still dump all of the databases or just the one it connects to?

It will dump all the databases. It is just that pg_dumpall is a client 
to the server and therefore needs to connect to a database within the 
cluster to do it's work. That is true of all the programs listed here:

https://www.postgresql.org/docs/11/reference-client.html

Programs that do not have to connect can be found here:

https://www.postgresql.org/docs/11/reference-server.html

> 
> On Thu, Jun 20, 2019 at 4:13 PM Adrian Klaver <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.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:
> 
>     https://www.postgresql.org/docs/11/app-pg-dumpall.html
> 
>     -l dbname
>     --database=dbname
> 
>           Specifies the name of the database to connect to for dumping
>     global
>     objects and discovering what other databases should be dumped. If not
>     specified, the postgres database will be used, and if that does not
>     exist, template1 will be used.
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (5+ messages)

Message-ID: <ff0673f6-95ac-1d8d-4b90-a9159eceecdc@aklaver.com>
Permalink:  ../ff0673f6-95ac-1d8d-4b90-a9159eceecdc@aklaver.com/
Also on:    postgresql.org/message-id/ff0673f6-95ac-1d8d-4b90-a9159eceecdc@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, espressobeanies@gmail.com
  Subject: Re: Why does the pg_dumpall command have a database option?
  In-Reply-To: <ff0673f6-95ac-1d8d-4b90-a9159eceecdc@aklaver.com>
  References: <CAOeD169OQpnu8qn1PaSoOEg=h8SAviKZcMUnfNobbXtX26H_Ww@mail.gmail.com> <d2d0b615-7e9b-afbb-5892-33aa12167e1b@aklaver.com> <CAOeD1693QJ6AAT5CaG0u71D+uK3N-5GFGr1H1VnPMeeccrP9xw@mail.gmail.com> <ff0673f6-95ac-1d8d-4b90-a9159eceecdc@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox