Re: Getting back names of databases

From: Jeff Hoffmann <jeff(at)propertykey(dot)com>
To: "G(dot) Anthony Reina" <reina(at)nsi(dot)edu>
Cc: "pgsql-general(at)hub(dot)org" <pgsql-general(at)hub(dot)org>
Subject: Re: Getting back names of databases
Date: 2000-05-22 18:13:48
Message-ID: 392978DC.7AE9ABB9@propertykey.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"G. Anthony Reina" wrote:
>
> I know that I've seen this somewhere in past messages, but I can't seem
> to find how to search the archives. Is the search engine offline?
>
> Anyway, I'm trying to write a shell script which will backup my
> databases to DAT tape. I'd like to know how I could get the list of
> existing database names from Postgres. For example, I have 3 databases
> named db01, db02, db03. How can I ask Postgres for these 3 names?
>
> Thanks.
> -Tony

from psql, you can do a \l (or from a command line psql -c "\l")

or you can query the system tables yourself:

select datname from pg_database

there's a lot of ways to skin that cat, it's just a matter of what works
best for you

jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Keith G. Murphy 2000-05-22 18:25:18 Re: Getting back names of databases
Previous Message Steve Wolfe 2000-05-22 18:09:35 Re: Getting back names of databases