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 <t...@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.


Reply via email to