1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-06 10:17:15 +03:00
Commit Graph

262 Commits

Author SHA1 Message Date
darikg
5844690138 Merge pull request #501 from koljonen/fixusing
Fix bug where "USING(<cursor>" wasn't detected properly + add test case
2016-05-15 14:44:15 -04:00
koljonen
ef99084954
Remove new test I added and edit the existing ones to cover the same case instead
As suggested by darikg
2016-05-15 20:29:48 +02:00
koljonen
838d4f6950
Remove dead code and fix a broken test (all found by Codacy) 2016-05-15 19:41:30 +02:00
darikg
30727196ed Merge pull request #497 from koljonen/allownonsetreturningfunctionsinfromclause
Improve filtering of functions for FROM clause
2016-05-15 13:01:10 -04:00
koljonen
fffa740fbc
Fix more test bugs ... apparently the able order can be indeterministic 2016-05-15 18:35:22 +02:00
koljonen
17a2b3a4b7
Fix some bugs in the tests I added 2016-05-15 18:05:48 +02:00
koljonen
926004eedd
Fix bug where "USING(<cursor>" wasn't detected properly + add test case 2016-05-14 19:08:53 +02:00
koljonen
de83a72abf
After code review: Remove "parent" field I added to Columns
It turned out there was a way to accomplish qualification of column names without it.
2016-05-14 18:40:32 +02:00
koljonen
b793ed5c00
Some changes after code review
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-14 18:19:55 +02:00
koljonen
6d920340b8
Fix tests I broke in eaf3a11c94 2016-05-14 15:04:55 +02:00
koljonen
16efe77433
Support for qualifiers in * expansion
This means that when the user expands the * in "select t.* from tbl t", the result is "select t.col1, t.col2, t.col3, ... from tbl t".
2016-05-09 14:35:14 +02:00
koljonen
eaf3a11c94
Improve filtering of functions for FROM clause
Change from filtering out all non-set-returning functions to only filteirng out windowing functions and aggregate functions.
Non-set-returning functions are legal in the FROM clause and can be quite useful.
2016-05-07 13:48:11 +02:00
Pavel Savchenko
1dabd3be63 Unquote URI parts prior to using in connection
As you know [RFC-3986][1] allows passing "disallowed" characters
as long as these are percent encoded.
Since we deal with the url parsing, we can expect this to happen
and need to use the values after they have been decoded.

[1]: https://tools.ietf.org/html/rfc3986#section-2.1
2016-04-27 17:58:16 +02:00
Anthony Lai
f1ff7158e0 Fix auto-completion breaking for table names with caps 2016-03-22 23:04:33 -07:00
Anthony Lai
eb3ef2e143 unescape completion names for lexical priority 2016-03-22 22:08:21 -07:00
Anthony Lai
1fe6ff06a2 Fix lexical order tiebreaking 2016-03-18 21:27:07 -07:00
Fernando Mora
6af6454e59 More appropiate dates/times types test name 2016-02-26 16:27:12 +01:00
Fernando Mora
5f4bded599 Issue #448. Add timestamptz to DATE custom extension 2016-02-26 16:21:27 +01:00
Daniel Rocco
66f9647210 Use lexical order to break ties when fuzzy matching 2016-02-14 23:33:23 -05:00
Amjith Ramanujam
fea50b59db Merge pull request #457 from dbcli/stuartquin/cast-bc-dates
Issue #448 extension for BC dates
2016-02-03 19:23:22 -08:00
David Szotten
d4ffbe6104 oh py2.6 how i don't miss you 2016-02-03 22:31:10 +00:00
David Szotten
85181ab252 factor out ensure_dir_exists and use for log 2016-02-03 22:28:04 +00:00
David Szotten
43a13ba065 a few more tests 2016-02-03 20:58:32 +00:00
David Szotten
bea392d7ed ensure target dir exists when copying config 2016-02-03 20:45:36 +00:00
Stuart Quin
37c10e45c8 Issue #448 extension for BC dates 2016-02-03 10:57:36 +00:00
David Szotten
f6c159e805 test for recent patch for execute_from_file
to prevent obvious regressions at least
2016-02-02 18:56:20 +00:00
Amjith Ramanujam
c4557a8215 Add a test case for enum unicode case. 2016-01-12 04:55:42 -08:00
David Szotten
2b867820d9 don't error when completing parameter-less functions 2016-01-05 16:32:31 +00:00
Darik Gamble
90651ca7fe Really sort keywords after everything else 2015-11-26 14:17:47 -05:00
Darik Gamble
0f70ccad31 Add a bunch of tests for multiple joins 2015-11-25 16:17:08 -05:00
Amjith Ramanujam
5dde125d93 Merge pull request #421 from dbcli/darikg/support-leading-double-quote
Handle manually entered double-quote gracefully
2015-11-24 11:17:31 -08:00
Darik Gamble
2c4f4e689d Add more tests for qualified table names with or without quotes 2015-11-23 16:48:27 -05:00
Darik Gamble
75a184571a Rename old test to avoid redefinition
'test_simple_select_with_cols_multiple_tables' was defined twice with different bodies
2015-11-23 14:39:31 -05:00
Amjith Ramanujam
b68c2ab38c Add tests for the format_output. 2015-11-22 05:46:06 -08:00
Darik Gamble
9295cb9686 Fix suggestions after a manually entered double quote escape 2015-11-21 16:39:30 -05:00
Darik Gamble
692afc8240 Replace suggestion dicts with namedtuples 2015-11-16 07:41:27 -05:00
Darik Gamble
5b5e861258 extract_tables returns tuples, not lists 2015-11-16 07:28:22 -05:00
Darik Gamble
0cf0b7ff59 Update pgcompleter tests 2015-11-08 15:55:50 -05:00
Darik Gamble
886b048af0 PGCompleter initializes a prevalence counter (not used yet) 2015-11-08 15:55:49 -05:00
Darik Gamble
9c97d35606 New package prioritization and class PrevalenceCounter 2015-11-08 15:54:15 -05:00
Darik Gamble
1ea9bf735b Refactor a lot of run_cli into smaller submethods:
`_build_cli`, '_evaluate_command` and `_handle_server_closed_connection`

_evalute_command returns (output, MetaQuery) tuple where MetaQuery is a namedtuple
(query, successful, total_time, meta_changed, db_changed, path_changed, mutated)
2015-10-28 10:58:29 -04:00
Darik Gamble
edcc5c8a2d pgexecute.run returns two extra tuple elements: query, and success 2015-10-28 10:58:28 -04:00
Darik Gamble
6df33e959d exception_formatter returns only status, not the entire results tuple 2015-10-28 10:58:27 -04:00
Darik Gamble
488ac21dae trivial indent fix 2015-10-28 10:58:25 -04:00
Darik Gamble
c9b55ba12e Fix pgexecute tests 2015-10-28 10:58:25 -04:00
Iryna Cherniavska
2be25f5358 Setproctitle should be optional in tests. 2015-10-26 15:00:42 -07:00
Jacek Wielemborek
74c67a6dc6 Add a test written by darikg. Not actually executed, please confirm it. 2015-10-25 20:01:54 +01:00
Amjith Ramanujam
cc7b9d2d56 Make setproctitle optional in Windows 2015-10-23 02:49:20 -07:00
Stuart Quin
eea0cbd495 Clearer function name, handle passwords with spaces 2015-10-19 18:40:50 +01:00
Stuart Quin
748fcb7677 Issue #355 Use setproctitle to hide command line passwords 2015-10-18 21:56:52 +01:00
Darik Gamble
947cdb9506 support different error-handling options 2015-10-10 15:05:30 -04:00
Iryna Cherniavska
08347934c4 Fix for behave tests failing with pexpect 4.0. 2015-10-05 14:11:31 -07:00
darikg
4055b726cc Merge pull request #368 from dbcli/darikg/suggest-columns-from-functions
Suggest columns from functions
2015-10-04 09:31:11 -04:00
Amjith Ramanujam
12207f39fe Merge pull request #373 from dbcli/darikg/fix-need_completion_refresh
Fix need_completion_refresh
2015-10-03 14:48:16 -07:00
Darik Gamble
bb12d553a4 Fix need_completion_refresh
Was only actually checking the first command in multiple commands
2015-10-03 14:41:50 -04:00
Darik Gamble
9a7cae6cf5 Expand more join tests to check compound statements 2015-10-03 14:10:51 -04:00
Darik Gamble
ee0995ceed Fix suggestions in compound join clauses
Previously, this worked correctly, suggesting columns etc. from `a`
`SELECT * FROM abc a JOIN def d ON a.`

But this suggested only keywords:
`SELECT * FROM abc a JOIN def d ON a.id = d.id AND a.`
2015-10-03 14:04:00 -04:00
Darik Gamble
38f5e875ef Add missing test assertion 2015-10-03 10:01:06 -04:00
Darik Gamble
fc25e576eb Delete outdated comment 2015-10-03 09:59:13 -04:00
Darik Gamble
62b2962b63 Suggest fields from functions used as tables 2015-09-29 09:07:20 -04:00
Darik Gamble
07030e20d2 Move FunctionMetadata definition into its own package 2015-09-29 09:07:20 -04:00
Darik Gamble
a0266de192 Extract functions in the FROM clause as tables 2015-09-29 08:54:49 -04:00
Iryna Cherniavska
2020e7204d Using pgspecial as a separate module. Warning: this branch will not build. 2015-09-26 17:51:51 -07:00
Darik Gamble
169eb3ff58 Suggest set-returning functions as tables 2015-09-23 14:09:38 -04:00
Darik Gamble
2e9dce513b pgexecute returns additional function metadata 2015-09-23 14:09:37 -04:00
Darik Gamble
431ba8f695 Don't hide functions from pg_catalog 2015-09-22 13:00:35 -04:00
Iryna Cherniavska
72ea4edcec Strip color codes out of behave actual output. 2015-09-13 11:21:13 -07:00
Iryna Cherniavska
870b613f6f When behave fails, it prints out expected and actual output. 2015-09-13 10:19:25 -07:00
Iryna Cherniavska
6664337a85 Functional test for refresh command. 2015-09-06 10:18:21 -07:00
Iryna Cherniavska
62af9d3a96 Added refresher tests. 2015-09-05 18:31:53 -07:00
Amjith Ramanujam
6e1bc6fcd1 Merge pull request #342 from dbcli/j-bennet/completion-in-named-query
Autocompletion in named queries.
2015-08-25 21:45:53 -07:00
Amjith Ramanujam
d222e085b7 Update the tests for named query. 2015-08-25 19:41:04 -07:00
Iryna Cherniavska
037e8c84a0 Minor test changes. 2015-08-25 19:35:40 -07:00
Iryna Cherniavska
31b867f632 Autocompletion in named queries. Connect #270. 2015-08-25 19:35:40 -07:00
Amjith Ramanujam
e4c18532c3 Merge pull request #344 from dbcli/j-bennet/fix-read-from-file
Added read_from_file back into iospecial.
2015-08-25 19:26:16 -07:00
Amjith Ramanujam
fb86930cd6 Add tests for where clause with keywords. 2015-08-24 19:31:25 -07:00
Iryna Cherniavska
da12a70cbb Added read_from_file back into iospecial (it was removed but is still being used. Added integration test for editing a file. 2015-08-24 17:46:40 -07:00
Amjith Ramanujam
585b37e70f Fix failing tests for python 3. 2015-08-23 01:50:09 -07:00
Amjith Ramanujam
65398f0051 Fix failing tests. 2015-08-23 01:43:54 -07:00
Amjith Ramanujam
72b8e60d18 Merge pull request #337 from dbcli/darikg/multiline_open_quotes
Don't end multi-line query within a quote
2015-08-19 21:54:11 -07:00
Darik Gamble
9be09b8bf4 Add function to check for unclosed quotations 2015-08-18 06:04:08 -04:00
Amjith Ramanujam
f2e436ad2f Fix unicode issues and update tests. 2015-08-18 00:38:56 -07:00
Amjith Ramanujam
5796fa2b4e Fix tests for multiple queries with syntax error. 2015-08-18 00:27:40 -07:00
Iryna Cherniavska
9a35e5ef05 Started adding "service" option. Connect #289.
Switched to dsn-based approach (no config parsing).
2015-08-13 23:40:11 -07:00
Amjith Ramanujam
ad9c99f790 Merge pull request #323 from dbcli/darikg/bugfix-283
Fix #283
2015-08-05 15:43:05 -07:00
Amjith Ramanujam
4b644bf2f1 Merge pull request #324 from dbcli/darikg/bugfix-322
Fix #322
2015-08-05 15:04:33 -07:00
Amjith Ramanujam
259f4897a2 Merge pull request #320 from dbcli/darikg/bugfix-317
Add regression test for #317
2015-08-05 15:01:14 -07:00
Amjith Ramanujam
9ab49a2145 Merge pull request #321 from dbcli/j-bennet/integration-tests
Fixes for test database being in use problem.
2015-08-05 14:55:51 -07:00
Darik Gamble
3205fb0f85 Test completions with an escaped table alias 2015-08-05 15:47:27 -04:00
Darik Gamble
3ef99aa043 Test suggest_type with escaped table aliases 2015-08-05 15:46:13 -04:00
Darik Gamble
21125e8820 Test extract_tables with escaped table aliases 2015-08-05 15:45:40 -04:00
Darik Gamble
6a2771a9a2 Add tests for \c and \connect to suggest databases 2015-08-05 14:32:35 -04:00
Iryna Cherniavska
a895703201 Shortened expect timeouts. 2015-08-05 09:00:55 -07:00
Iryna Cherniavska
10d76fb978 Fixes for test database being in use problem. 2015-08-05 08:50:54 -07:00
Darik Gamble
e97cc6586d Add regression test for #317 2015-08-05 09:40:31 -04:00
darikg
a25dc906af Merge pull request #311 from dbcli/amjith/autocompletion-crash
Fix the crashing autocompletion on joins.
2015-08-02 10:34:49 -04:00
Amjith Ramanujam
09ccb535ec Add a test for the crashing bug fix. 2015-08-01 08:29:33 -07:00
Amjith Ramanujam
5de07bdbde Fix the crashing autocompletion on joins. 2015-08-01 08:22:31 -07:00
Amjith Ramanujam
1f147f5e7a Merge pull request #300 from dbcli/j-bennet/integration-tests
More integration tests
2015-08-01 07:45:22 -07:00
Iryna Cherniavska
2c9056133a More fiddling with python version string. 2015-07-31 09:49:38 -07:00