Re: doubt about the database - Mailing list pgsql-general

From Scott Marlowe
Subject Re: doubt about the database
Date
Msg-id 1096418270.8192.22.camel@localhost.localdomain
Whole thread Raw
In response to doubt about the database  ("maridu h.s.n.v.prasad" <mhsnvprasad@yahoo.com>)
List 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@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.


pgsql-general by date:

Previous
From: "Ian Harding"
Date:
Subject: Re: porting a full Ms Sql Server to postgres
Next
From: Michael Fuhr
Date:
Subject: Re: Foreign key order evaluation