summaryrefslogtreecommitdiffstats
path: root/tests/test_smart_completion_public_schema_only.py
AgeCommit message (Collapse)Author
2017-03-06Add MATERIALIZED VIEW keywordsJoakim Koljonen
2017-02-25Suggest keywords after ALTERDarik Gamble
2016-12-05Support for table-qualifying column suggestionskoljonen
... i.e. suggesting foo.fooid instead of just fooid Controlled using a config-file setting: **qualify_columns**: always/never/**if_more_than_one_table**. To enable the proper sorting of qualified column suggestions, we introduce the concept of synonyms for suggestions (in `pgcompleter.find_matches`). They way synonyms work is that a number of synonyms may be provided for a suggestion sent to `find_matches`. If synonyms are provided, sorting is based on how well the best synonym matches the input, instead of only comparing the input to the suggestion text. In this case, the unqualified name acts as a synonym. I have a couple of other ideas of use cases where we can use synonyms to get better completions with less typing for the user, which I intend to explore later.
2016-09-04Support configuring keyword casing preferencesDarik Gamble
2016-08-08Merge pull request #553 from dbcli/darikg/cte-suggestionsAmjith Ramanujam
CTE-aware suggestions
2016-07-27Make suggestions based on local tablesDarik Gamble
2016-07-08Some changes to sorting of suggestionsJoakim Koljonen
2016-07-06Better scoping for tables in insert statementskoljonen
This commit makes it so that given `INSERT INTO foo(<cursor1>) SELECT <cursor2> FROM bar;`, we suggest `bar` columns for `<cursor2>` and `foo` columns for `<cursor1>`. Previous behaviour is sugggesting columns from both tables in both cases.
2016-06-27Suggest table aliases + add tests for casingkoljonen
If config.main.generate_aliases is True, for `SELECT * FROM `, we suggest `FooBar FB` and `foo_bar fb` instead of `FooBar` and `foo_bar`, respectively. To be able to add a test, I had to add support for testing with different settings, which meant I could also add tests for casing. There are two non-obvious changes that I can think of: 1. The lexical sorting of matches is modified so as to sort spaces and underscores before letters and to sort case-insensitively. This is so that e.g `Foob F` comes before 'FooBar FB' when `foob` is input. 2. We now suggest `some_func()` instead of `some_func` (because suggesting `some_func sf` didn't make any sense).
2016-06-18Fix indentation of test_smart_completion_* metadata dictskoljonen
2016-06-18In completion tests, get columns from metadata instead of manually listing themkoljonen
2016-06-18In completion tests, get functions from metadata instead of manually listing ↵koljonen
them
2016-06-18In completion tests, get views from metadata instead of manually listing themkoljonen
2016-06-18In completion tests, get tables from metadata instead of manually listing themkoljonen
2016-06-18In completion tests, get datatypes from metadata instead of manually listing ↵koljonen
them
2016-06-18In completion tests, get schemas from metadata instead of manually listing themkoljonen
2016-06-18Consolidate common code in smart_completion testskoljonen
2016-06-16Fix some join-condition issueskoljonen
When self-joining a table with an FK to or from some other table, we got a false FK-join suggestion for that column. There was also a problem with quoted tables not being quoted in the join condition. And there were a couple of problems when trying to join a non-existent table or using a non-existent qualifier (`SELECT * FROM Foo JOIN Bar ON Meow.`). I also rewrote get_join_condition_matches a bit in the process, hopefully making it a bit simpler.
2016-06-14Add a couple of tests suggested by @darikgkoljonen
2016-06-14Join conditions: alias tables already included in querykoljonen
If we have the input `SELECT * FROM Foo JOIN `, we now suggest `Foo Foo2 ON Foo2.ParentID = Foo.ID` (given the appropriate casing file and FK). There were also some problems with quoted tables and with the casing of table aliases, which are now fixed. I also made a few cosmetic changes to get_join_matches (pgcompleter.py) just to make it a bit easier to work with.
2016-06-10Also exclude NATURAL JOIN from join suggestionskoljonen
2016-06-10Various changes after reviewkoljonen
2016-06-02Use pg_proc.proargmodes &c. instead of parsing arg_listkoljonen
Getting the parameters from proargnames, proallargtypes and proargmodes instead of from parsing the arg_list string simplifies FunctionMetadata quite a bit. I also made the ColumnMetadata for table/view columns use the same format for the type (i.e. regtype instead of typname). This means we now get join-condition suggestions for joining tables/views to functions, which didn't work before.
2016-05-31Fix issue with 'SELECT Foo.*<cursor> FROM Foo'koljonen
In the expansion, we got '"Foo".<col>' when we should have gotten 'Foo.<col>'.
2016-05-24Make join-condition suggestions work with multi-line querieskoljonen
2016-05-24Support for join-condition suggestions after ONkoljonen
The user types 'SELECT * FROM parenttable p JOIN childtable c on '. We then suggest ['c.parenttableid = p.parenttableid', 'c.createdby = p.createdby', ...] as completions. The suggestions are FK matches first, then name matches for int columns, then name matches for other columns, sorted by proximity from the cursor to the other table. Some changes: For "JOIN Foo USING(<cursor>)", now only columns present in Foo are suggested. For all suggestions after 'ON', now only the tables before the cursor are considered. meta[reltype]][relname] goes from being a list of columns to being an OrderedDict {column_name:ColumnMetadata}, where the ColumnMetaData contains the column's name, data type and a list of FKs involving the column. This entails modification of a number of functions dealing with columns.
2016-05-20Fix problem where table names would not be recognized when not in lower casekoljonen
2016-05-17Stop suggesting * as a columnkoljonen
I don't think suggesting * is of use to anyone, and it's in the way for anyone who just wants a column.
2016-05-16Merge pull request #502 from koljonen/cleanupdarikg
Remove dead code and fix a broken test
2016-05-16Merge pull request #492 from koljonen/masterdarikg
Completion to column list when * is entered
2016-05-16Remove obsolete commentskoljonen
2016-05-16Various small changes after code reviewkoljonen
2016-05-15Merge pull request #501 from koljonen/fixusingdarikg
Fix bug where "USING(<cursor>" wasn't detected properly + add test case
2016-05-15Remove new test I added and edit the existing ones to cover the same case ↵koljonen
instead As suggested by darikg
2016-05-15Remove dead code and fix a broken test (all found by Codacy)koljonen
2016-05-15Fix more test bugs ... apparently the able order can be indeterministickoljonen
2016-05-15Fix some bugs in the tests I addedkoljonen
2016-05-14Some changes after code reviewkoljonen
Move *-expansion logic from find_matches to get_column_matches Make the expansion always qualify column names if there's more than one table. For this I changed populate_scoped_columns to return a dict{TableReference:[column names]}; I took this code from my other branch joinconditions. Add a bunch of tests
2016-05-14Fix tests I broke in eaf3a11c944d14163fd0e4ec13cc10eabbae972fkoljonen
2016-03-22unescape completion names for lexical priorityAnthony Lai
2016-03-18Fix lexical order tiebreakingAnthony Lai
2015-11-26Really sort keywords after everything elseDarik Gamble
2015-11-25Add a bunch of tests for multiple joinsDarik Gamble
2015-11-21Fix suggestions after a manually entered double quote escapeDarik Gamble
2015-11-08Update pgcompleter testsDarik Gamble
2015-09-29Suggest fields from functions used as tablesDarik Gamble
2015-09-29Move FunctionMetadata definition into its own packageDarik Gamble
2015-09-23Suggest set-returning functions as tablesDarik Gamble
2015-09-23pgexecute returns additional function metadataDarik Gamble
2015-08-23Fix failing tests.Amjith Ramanujam