pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedWhy does the pg_dumpall command have a database option?
5+ messages / 3 participants
[nested] [flat]
* Why does the pg_dumpall command have a database option?
@ 2019-06-20 20:03 Espresso Beanies <espressobeanies@gmail.com>
2019-06-20 20:13 ` Re: Why does the pg_dumpall command have a database option? Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 5+ messages in thread
From: Espresso Beanies @ 2019-06-20 20:03 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
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,
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Why does the pg_dumpall command have a database option?
2019-06-20 20:03 Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
@ 2019-06-20 20:13 ` Adrian Klaver <adrian.klaver@aklaver.com>
2019-06-21 13:32 ` Re: Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
0 siblings, 1 reply; 5+ messages in thread
From: Adrian Klaver @ 2019-06-20 20:13 UTC (permalink / raw)
To: Espresso Beanies <espressobeanies@gmail.com>; pgsql-general@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Why does the pg_dumpall command have a database option?
2019-06-20 20:03 Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
2019-06-20 20:13 ` Re: Why does the pg_dumpall command have a database option? Adrian Klaver <adrian.klaver@aklaver.com>
@ 2019-06-21 13:32 ` Espresso Beanies <espressobeanies@gmail.com>
2019-06-21 13:38 ` Re: Why does the pg_dumpall command have a database option? Ray O'Donnell <ray@rodonnell.ie>
2019-06-21 13:51 ` Re: Why does the pg_dumpall command have a database option? Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 5+ messages in thread
From: Espresso Beanies @ 2019-06-21 13:32 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org
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.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
>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Why does the pg_dumpall command have a database option?
2019-06-20 20:03 Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
2019-06-20 20:13 ` Re: Why does the pg_dumpall command have a database option? Adrian Klaver <adrian.klaver@aklaver.com>
2019-06-21 13:32 ` Re: Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
@ 2019-06-21 13:38 ` Ray O'Donnell <ray@rodonnell.ie>
1 sibling, 0 replies; 5+ messages in thread
From: Ray O'Donnell @ 2019-06-21 13:38 UTC (permalink / raw)
To: Espresso Beanies <espressobeanies@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org
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.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:
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@rodonnell.ie
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Why does the pg_dumpall command have a database option?
2019-06-20 20:03 Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
2019-06-20 20:13 ` Re: Why does the pg_dumpall command have a database option? Adrian Klaver <adrian.klaver@aklaver.com>
2019-06-21 13:32 ` Re: Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
@ 2019-06-21 13:51 ` Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 5+ messages in thread
From: Adrian Klaver @ 2019-06-21 13:51 UTC (permalink / raw)
To: Espresso Beanies <espressobeanies@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-06-21 13:51 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 20:03 Why does the pg_dumpall command have a database option? Espresso Beanies <espressobeanies@gmail.com>
2019-06-20 20:13 ` Adrian Klaver <adrian.klaver@aklaver.com>
2019-06-21 13:32 ` Espresso Beanies <espressobeanies@gmail.com>
2019-06-21 13:38 ` Ray O'Donnell <ray@rodonnell.ie>
2019-06-21 13:51 ` Adrian Klaver <adrian.klaver@aklaver.com>
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