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.
psql has it. I'm using version 8.2.7 on server version 8.2.6
SEL
and press tab, it will autocomplete to SELECT
. However, it doesn't seem to be able to autocomplete column names. –
Baronage CTL+space
works quite nicely for pgAdmin
query tool, but not for psql
on windows –
Broadcasting You might like pgcli which provide completion for join and other nice features. However, it lacks some \*
helpers like \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.
Simple answer below:
I spent a long time trying to get tab-complete to work on the psql client AND the SQL shell (psql) client. Here's what you do.
Stop trying and use the client found here: pgcli
I installed using pip, opened the client using >pgcli -Upostgres
, and entered the same password created with I installed Postgresql. Tab-completion works and I'm good to go.
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:
select * from users u join posts p where p.AUTOCOMPLETE
No support for common table expressions sadly.
To use autocomplete, begin typing your query; when you would like the Query editor to suggest object names or commands that might be next in your query, press the Control+Space key combination.
pgAdmin
not psql
. But does work quite nicely in pgAdmin
–
Broadcasting Autocompletion for keywords For keywords just type a few characters and press the Control + Space key combination.
© 2022 - 2025 — McMap. All rights reserved.