tab completion of enum values is broken
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-01-13T11:23:02Z
Lists: pgsql-hackers
This doesn't work anymore:
create type e2 as enum ('foo', 'bar');
alter type e2 rename value 'b<TAB>
This now results in
alter type e2 rename value 'b'
Bisecting blames
commit cd69ec66c88633c09bc9a984a7f0930e09c7c96e
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu Jan 23 11:07:12 2020 -0500
Improve psql's tab completion for filenames.
which did deal with quoting of things to be completed, so it seems very
plausible to be some collateral damage.
The queries issued by the completion engine are
bad
LOG: statement: SELECT pg_catalog.quote_literal(enumlabel) FROM
pg_catalog.pg_enum e, pg_catalog.pg_type t WHERE t.oid = e.enumtypid
AND substring(pg_catalog.quote_literal(enumlabel),1,1)='b' AND
(pg_catalog.quote_ident(typname)='e2' OR '"' || typname ||
'"'='e2') AND pg_catalog.pg_type_is_visible(t.oid) LIMIT 1000
good
LOG: statement: SELECT pg_catalog.quote_literal(enumlabel) FROM
pg_catalog.pg_enum e, pg_catalog.pg_type t WHERE t.oid = e.enumtypid
AND substring(pg_catalog.quote_literal(enumlabel),1,2)='''b' AND
(pg_catalog.quote_ident(typname)='e2' OR '"' || typname ||
'"'='e2') AND pg_catalog.pg_type_is_visible(t.oid) LIMIT 1000
I tried quickly fiddling with the substring() call to correct for the
changed offset somehow, but didn't succeed. Needs more analysis.
Commits
-
Fix psql's tab-completion of enum label values.
- fe75517443b7 15.0 landed
- d91d4338e054 14.2 landed
- 90a847e6dcc8 13.6 landed
-
Improve psql's tab completion for filenames.
- cd69ec66c886 13.0 cited