forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita6699f6
committed
Attached are two patches for psql's tab-completion.c.
The first cleans up a couple of minor errors and ommissionsand adds tab completion support to more slash commands, e.g.\dv.The second is an attempt to add tab completion for schemasand fully qualified relation names (e.g. public.mytable ).I think this covers the TODO-item:"Allow psql to do table completion for SELECT * FROM schema_part and tablecompletion for SELECT * FROM schema_name."This happens via union selects querying: - relation_name in current search path; - schema_name; - schema.relation_namematching the current input string.E.g: SELECT p[TAB]will produce a list of all appropriate relation names in the current searchpath which begin with 'p', and also all schema names which begin with 'p'; \d pub[TAB]will produce any relation names in the current search path and alsoany schema names beginning with 'pub'; \d public.[TAB]will produce a list of all relations in the schema 'public'; \d public.my[TAB]produces all relation names beginning with 'my' in schema 'public'.It seems to work for me; comments, suggestions, particularly regardingthe coding and queries, are very welcome.Note that tables, indexes, views and sequences relations in the'pg_catalog' namespace are excluded even though they are inthe current search path. I found not doing this produced annoying behaviourwhen expanding names beginning with 'p'. People who work with systemtables a lot may not like this though; I can look for another solutionif necessary.Ian Barwick1 parent9d6f5ee commita6699f6
1 file changed
+433
-73
lines changed0 commit comments
Comments
(0)