pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed'show databases' in psql way?
9+ messages / 7 participants
[nested] [flat]
* 'show databases' in psql way?
@ 2004-11-01 12:13 Erik Wasser <erik.wasser@iquer.net>
2004-11-01 12:23 ` Re: 'show databases' in psql way? Frank Bax <fbax@sympatico.ca>
2004-11-01 12:26 ` Re: 'show databases' in psql way? Ian Barwick <barwick@gmail.com>
2004-11-02 03:40 ` Re: 'show databases' in psql way? Greg Sabino Mullane <greg@turnstep.com>
2004-11-02 14:24 ` Re: 'show databases' in psql way? lorid <lorid@dri.edu>
0 siblings, 4 replies; 9+ messages in thread
From: Erik Wasser @ 2004-11-01 12:13 UTC (permalink / raw)
To: pgsql-sql
Hi list,
how can I list the databases in a postgresish way? I know about the '-l'
switch of 'psql' but is there a DBI/SQL-query way? I don't want to call
an external program only to list the databases. I've googled about this
problem but I only found the '-l'-way to this this.
Ideas? Solutions?
--
So long... Fuzz
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
2004-11-01 12:13 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
@ 2004-11-01 12:23 ` Frank Bax <fbax@sympatico.ca>
3 siblings, 0 replies; 9+ messages in thread
From: Frank Bax @ 2004-11-01 12:23 UTC (permalink / raw)
To: pgsql-sql
At 07:13 AM 11/1/04, Erik Wasser wrote:
>how can I list the databases in a postgresish way? I know about the '-l'
>switch of 'psql' but is there a DBI/SQL-query way? I don't want to call
>an external program only to list the databases. I've googled about this
>problem but I only found the '-l'-way to this this.
The -e switch of psql will display queries behind commands. So use this
option, the use 'l' as a command instead of a switch.
Frank
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
2004-11-01 12:13 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
@ 2004-11-01 12:26 ` Ian Barwick <barwick@gmail.com>
2004-11-01 12:33 ` Re: 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
3 siblings, 1 reply; 9+ messages in thread
From: Ian Barwick @ 2004-11-01 12:26 UTC (permalink / raw)
To: Erik Wasser <erik.wasser@iquer.net>; +Cc: pgsql-sql
On Mon, 1 Nov 2004 13:13:10 +0100, Erik Wasser <erik.wasser@iquer.net> wrote:
> Hi list,
>
> how can I list the databases in a postgresish way? I know about the '-l'
> switch of 'psql' but is there a DBI/SQL-query way? I don't want to call
> an external program only to list the databases. I've googled about this
> problem but I only found the '-l'-way to this this.
>
> Ideas? Solutions?
Start psql with the -E switch, and it shows the SQL used to generate
the output from psql's slash commands.
Ian Barwick
barwick@gmail.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
2004-11-01 12:13 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
2004-11-01 12:26 ` Re: 'show databases' in psql way? Ian Barwick <barwick@gmail.com>
@ 2004-11-01 12:33 ` Erik Wasser <erik.wasser@iquer.net>
0 siblings, 0 replies; 9+ messages in thread
From: Erik Wasser @ 2004-11-01 12:33 UTC (permalink / raw)
To: pgsql-sql
On Monday 01 November 2004 13:26, Ian Barwick wrote:
> Start psql with the -E switch, and it shows the SQL used to generate
> the output from psql's slash commands.
Thanks for the quick answer. I will remember this switch! B-)
--
So long... Fuzz
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
2004-11-01 12:13 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
@ 2004-11-02 03:40 ` Greg Sabino Mullane <greg@turnstep.com>
3 siblings, 0 replies; 9+ messages in thread
From: Greg Sabino Mullane @ 2004-11-02 03:40 UTC (permalink / raw)
To: pgsql-sql; +Cc: erik.wasser@iquer.net
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> how can I list the databases in a postgresish way? I know
> about the '-l' switch of 'psql' but is there a DBI/SQL-query way?
Yes, the DBI way is to use the "data_sources" function. Works
just fine for Postgres:
my @dbs = DBI->data_sources('Pg');
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200411012240
-----BEGIN PGP SIGNATURE-----
iD8DBQFBhwIHvJuQZxSWSsgRArd1AJ9hKXD+cSaM2L3RUXQdabuRofNFjwCfaHT0
+bRPuYhuED0mnlp1FRtvQQw=
=tsqe
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
2004-11-01 12:13 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
@ 2004-11-02 14:24 ` lorid <lorid@dri.edu>
2004-11-02 15:21 ` Re: 'show databases' in psql way? Achilleus Mantzios <achill@matrix.gatewaynet.com>
3 siblings, 1 reply; 9+ messages in thread
From: lorid @ 2004-11-02 14:24 UTC (permalink / raw)
To: Erik Wasser <erik.wasser@iquer.net>; +Cc: pgsql-sql
\z will list the tables in the dbase
\d tablename will list the columns in the table
---------------------
Erik Wasser wrote:
>Hi list,
>
>how can I list the databases in a postgresish way? I know about the '-l'
>switch of 'psql' but is there a DBI/SQL-query way? I don't want to call
>an external program only to list the databases. I've googled about this
>problem but I only found the '-l'-way to this this.
>
>Ideas? Solutions?
>
>
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
2004-11-01 12:13 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
2004-11-02 14:24 ` Re: 'show databases' in psql way? lorid <lorid@dri.edu>
@ 2004-11-02 15:21 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 0 replies; 9+ messages in thread
From: Achilleus Mantzios @ 2004-11-02 15:21 UTC (permalink / raw)
To: lorid <lorid@dri.edu>; +Cc: Erik Wasser <erik.wasser@iquer.net>; pgsql-sql
O lorid Ýãñáøå óôéò Nov 2, 2004 :
> \z will list the tables in the dbase
> \d tablename will list the columns in the table
>
or
foodb=# SELECT oid,* from pg_database ;
> ---------------------
> Erik Wasser wrote:
>
> >Hi list,
> >
> >how can I list the databases in a postgresish way? I know about the '-l'
> >switch of 'psql' but is there a DBI/SQL-query way? I don't want to call
> >an external program only to list the databases. I've googled about this
> >problem but I only found the '-l'-way to this this.
> >
> >Ideas? Solutions?
> >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
--
-Achilleus
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
@ 2004-11-02 15:03 Arash Zaryoun <Arash_Zaryoun@CBC.CA>
2004-11-03 03:46 ` Re: 'show databases' in psql way? Greg Sabino Mullane <greg@turnstep.com>
0 siblings, 1 reply; 9+ messages in thread
From: Arash Zaryoun @ 2004-11-02 15:03 UTC (permalink / raw)
To: lorid@dri.edu; achill@matrix.gatewaynet.com; +Cc: erik.wasser@iquer.net; pgsql-sql
in command line: psql template1 pgsql -l
in PSQL:
foodb=#> select datname from pg_database;
- Arash
>>> Achilleus Mantzios <achill@matrix.gatewaynet.com> 11/2/2004 10:21:06 AM >>>
O lorid ****** **** Nov 2, 2004 :
> \z will list the tables in the dbase
> \d tablename will list the columns in the table
>
or
foodb=# SELECT oid,* from pg_database ;
> ---------------------
> Erik Wasser wrote:
>
> >Hi list,
> >
> >how can I list the databases in a postgresish way? I know about the '-l'
> >switch of 'psql' but is there a DBI/SQL-query way? I don't want to call
> >an external program only to list the databases. I've googled about this
> >problem but I only found the '-l'-way to this this.
> >
> >Ideas? Solutions?
> >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
--
-Achilleus
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: 'show databases' in psql way?
2004-11-02 15:03 Re: 'show databases' in psql way? Arash Zaryoun <Arash_Zaryoun@CBC.CA>
@ 2004-11-03 03:46 ` Greg Sabino Mullane <greg@turnstep.com>
0 siblings, 0 replies; 9+ messages in thread
From: Greg Sabino Mullane @ 2004-11-03 03:46 UTC (permalink / raw)
To: pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
To be pedantic about it, use:
SELECT pg_catalog.quote_ident(datname) AS database
FROM pg_catalog.pg_database ORDER BY 1;
or if using version 8 or higher:
SELECT pg_catalog.quote_ident(datname) AS database,
pg_catalog.quote_ident(spcname) AS tablespace
FROM pg_catalog.pg_database
JOIN pg_catalog.pg_tablespace t ON (dattablespace=t.oid)
ORDER BY 1;
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200411022120
-----BEGIN PGP SIGNATURE-----
iD8DBQFBiFTSvJuQZxSWSsgRApflAJ0RiVndbc6u//cXX/S7uM8K91lWbgCfYVbC
MsRNWlP446AcvHm0UaGgEVo=
=S8Ft
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2004-11-03 03:46 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-01 12:13 'show databases' in psql way? Erik Wasser <erik.wasser@iquer.net>
2004-11-01 12:23 ` Frank Bax <fbax@sympatico.ca>
2004-11-01 12:26 ` Ian Barwick <barwick@gmail.com>
2004-11-01 12:33 ` Erik Wasser <erik.wasser@iquer.net>
2004-11-02 03:40 ` Greg Sabino Mullane <greg@turnstep.com>
2004-11-02 14:24 ` lorid <lorid@dri.edu>
2004-11-02 15:21 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2004-11-02 15:03 Re: 'show databases' in psql way? Arash Zaryoun <Arash_Zaryoun@CBC.CA>
2004-11-03 03:46 ` Greg Sabino Mullane <greg@turnstep.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