Hi All, Below are the details:
*Connect to default database:* *=====================* bash-4.1$ ./psql -p 5432 postgres Password: psql.bin (9.1.7) Type "help" for help. postgres=# *To list all available database:* *=====================* postgres=# \l+ List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description -----------+----------+----------+-------------+-------------+-----------------------+---------+------------+-------------------------------------------- pem | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres=CTc/postgres+| 29 MB | pg_default | | | | | | pem_user=Tc/postgres +| | | | | | | | pem_agent=Tc/postgres | | | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 6570 kB | pg_default | default administrative connection database template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 6457 kB | pg_default | unmodifiable empty database | | | | | postgres=CTc/postgres | | | template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 6457 kB | pg_default | default template for new databases | | | | | postgres=CTc/postgres | | | (4 rows) *To change Database:* *===============* postgres=# \c edb You are now connected to database "edb" as user "postgres". edb=# *To check list of schemas:* *===================* postgres=# \dn List of schemas Name | Owner --------+---------- abdul | postgres public | postgres (2 rows) *To set a Schema for a session:* *=======================* postgres=# set search_path to abdul; SET postgres=# show search_path ; search_path ------------- abdul (1 row) postgres=# create table test (n numeric, Name varchar(10)); CREATE TABLE postgres=# insert into test values (generate_series(1,10),'TEST'); INSERT 0 10 postgres=# select * from test; n | name ----+------ 1 | TEST 2 | TEST 3 | TEST 4 | TEST 5 | TEST 6 | TEST 7 | TEST 8 | TEST 9 | TEST 10 | TEST (10 rows) *To list all tables of a current schema:* *===========================* postgres=# \dt+ List of relations Schema | Name | Type | Owner | Size | Description --------+------+-------+----------+-------+------------- abdul | test | table | postgres | 16 kB | (1 row) Hope this helps. Thanks & Regards, Abdul Sayeed System Engineer The Postgres Database Company Are you updated: Latest version of Postgres Plus Advanced Server are 8.4.19.42, 9.0.15.33, 9.1.11.19, 9.2.6.16, 9.3.2.5. To reach Support Call: US: +1-732-331-1320 - UK: +44 - 2033719820 Brazil: +55-2139581371 - India: +91-20-32676535 Website: www.enterprisedb.com EnterpriseDB Blog : http://blogs.enterprisedb.com Follow us on Twitter : http://www.twitter.com/enterprisedb ____________________________________________________________ CONFIDENTIALITY NOTICE This e-mail transmission and any documents, files, or previous e-mail messages appended or attached to it, may contain information that is confidential or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that you must not read this transmission and that any disclosure, copying, printing, distribution, or use of the information contained or attached to this transmission is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender by telephone or return e-mail message and delete the original transmission, its attachments, and any copies without reading or saving in any manner. Thank you. On Thu, Jan 2, 2014 at 4:34 PM, Raymond O'Donnell <r...@iol.ie> wrote: > On 02/01/2014 01:53, peterlen wrote: > > I am using PostgreSQL 9.1 and have boon looking for psql commands to > list all > > tables in the current database as well as how to "describe" a given > table. > > I have come across some info on the web (older mostly) that lists > commands > > like \d, \dt, or \d+ <tablename> but I get results like "no relations > found" > > or "column reltriggers does not exist". Not sure what is going on. > > > > Can someone enlighten me on the right commands to use? > > Possibly a silly question, but are you connected to the correct > database? If you don't specify a database on the psql command line, then > psql connects to a database with the same name as the username you use > to connect, if such a database exists. > > Ray. > > > -- > Raymond O'Donnell :: Galway :: Ireland > r...@iol.ie > > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general >