Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete for DDL commands #196

Open
nineinchnick opened this issue Mar 26, 2021 · 4 comments · Fixed by #286 · May be fixed by #429
Open

Autocomplete for DDL commands #196

nineinchnick opened this issue Mar 26, 2021 · 4 comments · Fixed by #286 · May be fixed by #429
Assignees
Milestone

Comments

@nineinchnick
Copy link
Member

Implement autocomplete for DDL commands like CREATE, ALTER, and DROP.

@rubiagatra
Copy link
Contributor

It is okay to see the implementation on #286 to create autocomplete for ALTER and DROP @nineinchnick ?

@nineinchnick
Copy link
Member Author

@rubiagatra PRs are always welcome! Using the PR you mentioned as an example, one could attempt to translate more parts of https://github.com/postgres/postgres/blob/master/src/bin/psql/tab-complete.c#L1740 from C to Go.

@rubiagatra
Copy link
Contributor

rubiagatra commented Oct 18, 2023

hi @nineinchnick just want ask some questions. I recently create #428 Do you want to complete CREATE first?

e.g

in psql

postgres=# CREATE
ACCESS METHOD        DATABASE             FOREIGN TABLE        MATERIALIZED VIEW    PUBLICATION          SERVER               TEMP                 TYPE                 VIEW
AGGREGATE            DOMAIN               FUNCTION             OPERATOR             ROLE                 STATISTICS           TEMPORARY            UNIQUE
CAST                 EVENT TRIGGER        GROUP                OR REPLACE           RULE                 SUBSCRIPTION         TEXT SEARCH          UNLOGGED
COLLATION            EXTENSION            INDEX                POLICY               SCHEMA               TABLE                TRANSFORM            USER
CONVERSION           FOREIGN DATA WRAPPER LANGUAGE             PROCEDURE            SEQUENCE             TABLESPACE           TRIGGER              USER MAPPING FOR

currently in usql

pg:postgres@localhost/test=> CREATE
DATABASE  SCHEMA    SEQUENCE  TABLE     VIEW      TEMPORARY

@nineinchnick
Copy link
Member Author

usql works with many more SQL dialects than just PostgreSQL. It's easy to add all the keywords from psql to the autocompleter, but I haven't done that yet because they might be invalid in some databases and right now we only have one generic completer. Most of them are also rarely used.

I think ALTER statements might be more useful, and are also pretty common.

@rubiagatra rubiagatra linked a pull request Oct 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants