Postgresql 自动完成?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3630588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Postgresql autocomplete?
提问by phillipwei
Is there something that provides auto-completion for PostgreSQL? I'm looking for something similar to RedGate's SQLPrompt. Currently using pgAdmin III's query tool but willing to consider other query editors.
是否有为 PostgreSQL 提供自动完成功能的东西?我正在寻找类似于 RedGate 的 SQLPrompt 的东西。目前使用 pgAdmin III 的查询工具但愿意考虑其他查询编辑器。
采纳答案by Dave Aaron Smith
psql has it. I'm using version 8.2.7 on server version 8.2.6
psql 有。我在服务器版本 8.2.6 上使用版本 8.2.7
回答by étienne Bersac
You might like pgcliwhich provide completion for join and other nice features. However, it lacks some \*
helpers like \dF...
.
您可能会喜欢pgcli,它提供了 join 的补全和其他不错的功能。但是,它缺少一些\*
像\dF...
.
cave> \d appellation
+-----------+---------+-----------------------------------------------------------+
| Column | Type | Modifiers |
|-----------+---------+-----------------------------------------------------------|
| id | integer | not null default nextval('appellation_id_seq'::regclass) |
| libelle | text | not null |
| region_id | integer | |
+-----------+---------+-----------------------------------------------------------+
Indexes:
"appellation_pkey" PRIMARY KEY, btree (id)
"appellation_libelle_key" UNIQUE CONSTRAINT, btree (libelle)
Foreign-key constraints:
"appellation_region_id_fkey" FOREIGN KEY (region_id) REFERENCES region(id) ON DELETE CASCADE
Referenced by:
TABLE "vin" CONSTRAINT "vin_appellation_id_fkey" FOREIGN KEY (appellation_id) REFERENCES appellation(id) ON DELETE CASCADE
Time: 0.006s
cave> SELECT * FROM appellation JOIN _
region ON region.id = appellation.region_id join
vin ON vin.appellation_id = appellation.id join
In this example two joins are proposed corresponding to foreign keys.
在这个例子中,提出了两个对应于外键的连接。
回答by jdwyah
The support for autocomplete in NetBeans is amazing. Infinitely better than the basic psql imho. It understands table aliases so you can do something like:
NetBeans 中对自动完成的支持令人惊叹。无限好于基本的 psql imho。它了解表别名,因此您可以执行以下操作:
select * from users u join posts p where p.AUTOCOMPLETE
select * from users u join posts p where p.AUTOCOMPLETE
No support for common table expressions sadly.
遗憾的是不支持公用表表达式。