[英]Postgres sql list all tables in a database
“ psql \\ dt information_schema”我正在编写此命令以查看所有表的列表,并询问““ user information_schema的密码:”“我应该提供哪个密码,我要提供的是postgres作为密码。
使用以下命令的操作:
psql \dt information_schema
是启动psql并传递名称“ information_schema”作为要连接的用户名。
命令\\dt information_schema
有你已经开始PSQL 后 ,应进入一旦你看到psql的提示。
如果要直接在命令行中运行而不等待psql提示,则需要使用-c开关:
psql -c "\dt information_schema.*" postgres postgres
当运行psql --help
或查看手册时,将列出所有参数及其期望的顺序:
http://www.postgresql.org/docs/current/static/app-psql.html
编辑
这是一个示例控制台会话,向您展示如何执行此操作:
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 --
这是一次调用的方法:
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:\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.