473,466 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Listing databases

Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.

Thanks,
Doug Hall
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #1
16 2177
Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list the
available databases? I know how to log into a certain database, but not
list all of them. I know this must be possible because the phppgAdmin
web site demonstrates it with their trial server.

select * from pg_database;

Thanks,
Doug Hall
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

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

Nov 23 '05 #2
Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list the
available databases? I know how to log into a certain database, but not
list all of them. I know this must be possible because the phppgAdmin
web site demonstrates it with their trial server.

select * from pg_database;

Thanks,
Doug Hall
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

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

Nov 23 '05 #3
> Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


Use the \l command within psql.
--
Mike Nolan
---------------------------(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

Nov 23 '05 #4
> Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


Use the \l command within psql.
--
Mike Nolan
---------------------------(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

Nov 23 '05 #5

If you attach with psql then just use \l

Or this works as well

SELECT datname from pg_database;

Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.

Thanks,
Doug Hall
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #6

If you attach with psql then just use \l

Or this works as well

SELECT datname from pg_database;

Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.

Thanks,
Doug Hall
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #7
On Wed, May 05, 2004 at 04:20:29PM -0500, Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.
psql -l

--
Martijn van Oosterhout <kl*****@svana.org> http://svana.org/kleptog/ Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFAmWU6Y5Twig3Ge+YRAj1WAJ41k4ZioskqZpiF0Khkj1 Jg8343nwCeJwlu
gEEi0hnbjEEr8JXAJ5TkyTE=
=zxsd
-----END PGP SIGNATURE-----

Nov 23 '05 #8
On Wed, May 05, 2004 at 04:20:29PM -0500, Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.
psql -l

--
Martijn van Oosterhout <kl*****@svana.org> http://svana.org/kleptog/ Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFAmWU6Y5Twig3Ge+YRAj1WAJ41k4ZioskqZpiF0Khkj1 Jg8343nwCeJwlu
gEEi0hnbjEEr8JXAJ5TkyTE=
=zxsd
-----END PGP SIGNATURE-----

Nov 23 '05 #9
Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list the
available databases? I know how to log into a certain database, but not
list all of them. I know this must be possible because the phppgAdmin
web site demonstrates it with their trial server.

Thanks,
Doug Hall


Try \? in psql, it will show some really nice commands. \d will show you the
tables, and "\d tablename" will describe the table.

Try \dS and friends to see the system tables.

One of the best ways to see what is going on under the covers to to
run psql --echo-hidden:

--echo-hidden
Echoes the actual queries generated by \d and other
backslash commands. You can use this if you wish to
include similar functionality into your own pro*
grams. This is equivalent to setting the variable
ECHO_HIDDEN from within psql.

Whoever thought to add this to psql is a genius!!!

HTH...
Mark

--
Mark Harrison
Pixar Animation Studios

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #10
Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list the
available databases? I know how to log into a certain database, but not
list all of them. I know this must be possible because the phppgAdmin
web site demonstrates it with their trial server.

Thanks,
Doug Hall


Try \? in psql, it will show some really nice commands. \d will show you the
tables, and "\d tablename" will describe the table.

Try \dS and friends to see the system tables.

One of the best ways to see what is going on under the covers to to
run psql --echo-hidden:

--echo-hidden
Echoes the actual queries generated by \d and other
backslash commands. You can use this if you wish to
include similar functionality into your own pro*
grams. This is equivalent to setting the variable
ECHO_HIDDEN from within psql.

Whoever thought to add this to psql is a genius!!!

HTH...
Mark

--
Mark Harrison
Pixar Animation Studios

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #11
On Wed, May 05, 2004 at 04:20:29PM -0500, Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


With psql, you can use
psql -l

Else see the pg_database table.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"En las profundidades de nuestro inconsciente hay una obsesiva necesidad
de un universo lógico y coherente. Pero el universo real se halla siempre
un paso más allá de la lógica" (Irulan)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #12
On Wed, May 05, 2004 at 04:20:29PM -0500, Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


With psql, you can use
psql -l

Else see the pg_database table.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"En las profundidades de nuestro inconsciente hay una obsesiva necesidad
de un universo lógico y coherente. Pero el universo real se halla siempre
un paso más allá de la lógica" (Irulan)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #13
On Wed, 5 May 2004, Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


Assuming you're in psql just do:

\l


---------------------------(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

Nov 23 '05 #14
On Wed, 5 May 2004, Doug Hall wrote:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


Assuming you're in psql just do:

\l


---------------------------(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

Nov 23 '05 #15
El Mié 05 May 2004 18:52, Mike Nolan escribió:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


Use the \l command within psql.


I guess "psql -l" is better, so you can then choose the DB. :-)

--
19:10:02 up 7 days, 32 min, 1 user, load average: 0.60, 1.02, 1.38
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #16
El Mié 05 May 2004 18:52, Mike Nolan escribió:
Sorry for the newbie question, but how do you get PostgreSQL to list
the available databases? I know how to log into a certain database, but
not list all of them. I know this must be possible because the
phppgAdmin web site demonstrates it with their trial server.


Use the \l command within psql.


I guess "psql -l" is better, so you can then choose the DB. :-)

--
19:10:02 up 7 days, 32 min, 1 user, load average: 0.60, 1.02, 1.38
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Chris | last post by:
Hi, Not sure if this is the right forum, but hopefully someone can help me. I am creating something for our intranet and i want to list the files and folders of a directory, i found some code...
19
by: SU News Server | last post by:
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = listing =...
3
by: David Jacques | last post by:
I am trying to get a list of all files of a certain extension type on disk to do some processing in a loop. The code needs to be portable to UNIX, so I need to use plain c functionality. Does...
3
by: John Barr | last post by:
Does anyone know how to search for Instances of SQL Server running on your network through code to populate a drop down like is done in the SQL Server Query Analyzer, and then once an instance is...
2
by: Daniel Groh | last post by:
How do i list my databases (SQLServer) in my application ?
5
by: Steve | last post by:
I would like to provide users of a client program a list of databases on the network that match a certain pattern, like "%frp%". I have seen a list of databases in the Windows XP ODBC configuration...
2
by: Terry Olsen | last post by:
I'm building a database export program where I want to allow the user to choose a connection type (ODBC,OLEDB, or SQL), enter a connection string, and then export the schema and a number of rows of...
1
by: Johnny Jörgensen | last post by:
I've got a serious problem. I've got Visual Studio 2005 installed, and of course I'm using the Pretty Listing formatting function. When I start up VS, everything is fine, but after a while (which...
8
by: Swizylstik | last post by:
I'm a newbie to ASP and databases. I have created a simple contact list database and an asp page that shows the contact listing. So far so good. Here's what I have:...
5
by: jain236 | last post by:
HI every body, i am always getting the following error while parsing a directory . i am reading a directory by doing ls and trying to find out the name,type,size, mtime and mode of files from...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.