From: | "Scott Marlowe" <smarlowe(at)qwest(dot)net> |
---|---|
To: | "maridu h(dot)s(dot)n(dot)v(dot)prasad" <mhsnvprasad(at)yahoo(dot)com> |
Cc: | pgsql-general(at)PostgreSQL(dot)org |
Subject: | Re: doubt about the database |
Date: | 2004-09-29 00:37:50 |
Message-ID: | 1096418270.8192.22.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, 2004-09-26 at 01:49, maridu h.s.n.v.prasad wrote:
> subscribe
> end
>
> hai sir
> i am using the postgresql 7.2 my doubt is
> what is the command of to see the list of databases
> i create a database named "jntuoes"
> database created it's displayed
> but i want to know the command
> so please give me the replay
in psql, you use \l
smarlowe=> \l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
blog | smarlowe | SQL_ASCII
postgres | postgres | SQL_ASCII
smarlowe | smarlowe | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(5 rows)
If you want to execute a command to see it from SQL (i.e. an application
etc...) you can find the queries psql uses by starting it with the -E
switch, like so:
[smarlowe(at)localhost smarlowe]$ psql -E
Welcome to psql 7.4.5, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
smarlowe=> \l
********* QUERY **********
SELECT d.datname as "Name",
u.usename as "Owner",
pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding"
FROM pg_catalog.pg_database d
LEFT JOIN pg_catalog.pg_user u ON d.datdba = u.usesysid
ORDER BY 1;
**************************
List of databases
Name | Owner | Encoding
-----------+----------+-----------
blog | smarlowe | SQL_ASCII
postgres | postgres | SQL_ASCII
smarlowe | smarlowe | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(5 rows)
Hope that helps.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2004-09-29 00:51:51 | Re: Foreign key order evaluation |
Previous Message | Ian Harding | 2004-09-28 23:27:23 | Re: porting a full Ms Sql Server to postgres |