“psql \ dt information_schema”我正在编写此命令以查看所有表的列表及其要求“”用户information_schema的密码:“”我应该提供哪个密码,我meadn我提供了postgres作为密码。
答案 0 :(得分:3)
您使用以下命令执行的操作:
psql \dt information_schema
是启动psql并将名称“information_schema”作为要连接的用户名传递。
在启动psql之后,一旦看到psql提示符,就必须输入 命令{/ 1}。
如果要直接从命令行运行它而不等待psql提示符,则需要使用-c开关:
\dt information_schema
当您运行psql -c "\dt information_schema.*" postgres postgres
或查看手册时,会列出所有参数及其预期顺序:
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:\