0

"psql \dt information_schema" I am writing this command to see list of all tables and its asking ""Password for user information_schema:"" which Password should I provide ,I meadn I m providing the postgres as password.

asked Sep 16, 2011 at 11:25
0

1 Answer 1

3

What you are doing with the following command:

psql \dt information_schema

is to start psql and pass the name "information_schema" as the username to connect with.

The command \dt information_schema has to be entered after you have started psql and once you see the psql prompt.

If you want to run that directly from the command line without waiting for the psql prompt, you need to use the -c switch:

psql -c "\dt information_schema.*" postgres postgres

All parameters and the order in which they are expected are listed when you run psql --help or have a look at the manual:

http://www.postgresql.org/docs/current/static/app-psql.html

Edit

Here is a sample console session that shows you how to do this:

c:\>psql postgres postgres
Password for user postgres:
psql (9.0.4)
Type "help" for help.
postgres=# \dt information_schema.*
 List of relations
 Schema | Name | Type | Owner
--------------------+-------------------------+-------+----------
 information_schema | sql_features | table | postgres
 information_schema | sql_implementation_info | table | postgres
 information_schema | sql_languages | table | postgres
 information_schema | sql_packages | table | postgres
 information_schema | sql_parts | table | postgres
 information_schema | sql_sizing | table | postgres
 information_schema | sql_sizing_profiles | table | postgres
(7 rows)
postgres=# \dv information_schema.*
 List of relations
 Schema | Name | Type | Owner
--------------------+-----------------------------------+------+---------
 information_schema | _pg_foreign_data_wrappers | view | postgres
 information_schema | _pg_foreign_servers | view | postgres
 information_schema | _pg_user_mappings | view | postgres
 information_schema | administrable_role_authorizations | view | postgres
 information_schema | applicable_roles | view | postgres
 information_schema | attributes | view | postgres
 information_schema | check_constraint_routine_usage | view | postgres
 information_schema | check_constraints | view | postgres
 information_schema | column_domain_usage | view | postgres
 information_schema | column_privileges | view | postgres
 information_schema | column_udt_usage | view | postgres
 information_schema | columns | view | postgres
 information_schema | constraint_column_usage | view | postgres
 information_schema | constraint_table_usage | view | postgres
 information_schema | data_type_privileges | view | postgres
 information_schema | domain_constraints | view | postgres
 information_schema | domain_udt_usage | view | postgres
-- More --

And here is how to do it in one call:

c:\>psql -c "\dt information_schema.*" postgres postgres
Password for user postgres:
 List of relations
 Schema | Name | Type | Owner
--------------------+-------------------------+-------+----------
 information_schema | sql_features | table | postgres
 information_schema | sql_implementation_info | table | postgres
 information_schema | sql_languages | table | postgres
 information_schema | sql_packages | table | postgres
 information_schema | sql_parts | table | postgres
 information_schema | sql_sizing | table | postgres
 information_schema | sql_sizing_profiles | table | postgres
(7 rows)
c:\
mu is too short
436k71 gold badges862 silver badges821 bronze badges
answered Sep 16, 2011 at 12:15
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.