Postgresql autocomplete?
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.
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.
psql has it. I'm using version 8.2.7 on server version 8.2.6