get list of databases and tables in Postgres

LS,

Hope you can help : I am looking for equivalent sql statement for the
following in MySQL :
SHOW DATABASES

I found out that for the tables you can connect to a Postgresql specific
table information_schema.tables , but what is the corresponding table
for the names of databases under Postgresql ?

All help is highly appreciated.



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Wim Paulussen [ Mo, 01 März 2004 12:00 ] [ ID #141655 ]

Re: get list of databases and tables in Postgres

Use:

select datname from pg_database;

===============
Mihir & Biren
Partners
Majolee InfoTech
===============
----- Original Message -----
From: "Wim Paulussen" <wim [at] chen.be>
To: <pgsql-php [at] postgresql.org>
Sent: Monday, March 01, 2004 4:30 PM
Subject: [PHP] get list of databases and tables in Postgres


> LS,
>
> Hope you can help : I am looking for equivalent sql statement for the
> following in MySQL :
> SHOW DATABASES
>
> I found out that for the tables you can connect to a Postgresql specific
> table information_schema.tables , but what is the corresponding table
> for the names of databases under Postgresql ?
>
> All help is highly appreciated.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
>


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
Majolee InfoTech [ Mo, 01 März 2004 12:41 ] [ ID #141656 ]

Re: get list of databases and tables in Postgres

> select datname from pg_database;

Or simply:

\d

unless I'm missing something...

Chris


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
Chris Boget [ Mo, 01 März 2004 15:29 ] [ ID #141657 ]

Re: get list of databases and tables in Postgres

Chris Boget wrote:

>>select datname from pg_database;
> Or simply:
> \d
> unless I'm missing something...
> Chris

Would PGSQL respond to that as a query?
--
D. Wokan

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo [at] postgresql.org)
Digital Wokan [ Mo, 01 März 2004 21:58 ] [ ID #141658 ]

Re: get list of databases and tables in Postgres

using psql
psql -l

=3D=3D=3D=3D=3D
=C2ngelo Marcos Rigo
AMR Inform=E1tica
(51) 3348 0870
Rua Pe. Alois Kades 400/210
Porto Alegre /RS/Brasil
http://amr.freezope.org
angelo_rigo [at] yahoo.com.br



____________________________________________________________ __________

Yahoo! Mail - O melhor e-mail do Brasil! Abra sua conta agora:
http://br.yahoo.com/info/mail.html

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
angelo_rigo [ Mo, 01 März 2004 22:10 ] [ ID #141659 ]

Re: get list of databases and tables in Postgres

He wants to do it through PHP - so I don't think this will work.

You could always

psql -E -l

BUT - that query *could* change depending on the version of postgresql
you're running.

Chris.

-----Original Message-----
From: pgsql-php-owner [at] postgresql.org
[mailto:pgsql-php-owner [at] postgresql.org] On Behalf Of Chris Boget
Sent: Tuesday, March 02, 2004 1:29 AM
To: Majolee InfoTech; Wim Paulussen
Cc: pgsql-php [at] postgresql.org
Subject: Re: [PHP] get list of databases and tables in Postgres


> select datname from pg_database;

Or simply:

\d

unless I'm missing something...

Chris


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo [at] postgresql.org)
Chris Smith [ Mo, 01 März 2004 23:30 ] [ ID #141661 ]

Re: get list of databases and tables in Postgres

If you're running 7.4, look into the iformation_schema for such things.
That likely won't change.

On Tue, 2 Mar 2004, Chris Smith wrote:

> He wants to do it through PHP - so I don't think this will work.
>
> You could always
>
> psql -E -l
>
> BUT - that query *could* change depending on the version of postgresql
> you're running.
>
> Chris.
>
> -----Original Message-----
> From: pgsql-php-owner [at] postgresql.org
> [mailto:pgsql-php-owner [at] postgresql.org] On Behalf Of Chris Boget
> Sent: Tuesday, March 02, 2004 1:29 AM
> To: Majolee InfoTech; Wim Paulussen
> Cc: pgsql-php [at] postgresql.org
> Subject: Re: [PHP] get list of databases and tables in Postgres
>
>
> > select datname from pg_database;
>
> Or simply:
>
> \d
>
> unless I'm missing something...
>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo [at] postgresql.org)
>


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo [at] postgresql.org so that your
message can get through to the mailing list cleanly
Scott Marlowe [ Mo, 01 März 2004 23:31 ] [ ID #141662 ]
Datenbanken » gmane.comp.db.postgresql.php » get list of databases and tables in Postgres

Vorheriges Thema: SQLSTATE in PHP?
Nächstes Thema: Too many clients