dbcli / dbcli/pgcli

NoneType exception in get_completions()

Aperta
#1,204 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug help wanted
Lingua principale
Python
Stelle
13.4k
Fork
612
Merge medio
6g 14h
PR unite (30g)
10

Descrizione

## Description
With this SQL:
```sql
CREATE EXTENSION hstore;

CREATE OR REPLACE FUNCTION no_labels() RETURNS hstore AS $$
SELECT hstore(ARRAY[]::text[])
$$ language sql immutable;

CREATE OR REPLACE FUNCTION labels() RETURNS hstore AS $$
SELECT no_labels()
$$ language sql immutable;

CREATE OR REPLACE FUNCTION labels(variadic text[]) RETURNS hstore AS $$
SELECT hstore($1)
$$ language sql immutable;
```

When editing this query:

pgcli> select * from labels()
-- ^ start inserting each( here

As soon as the `(` after `each` is inserted, this traceback appears:
```
Unhandled exception in event loop:
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.8/site-packages/prompt_toolkit/eventloop/async_generator.py", line 43, in runner
for item in get_iterable():
File "/usr/lib/python3.8/site-packages/prompt_toolkit/completion/base.py", line 226, in
lambda: self.completer.get_completions(document, complete_event)
File "/usr/lib/python3.8/site-packages/prompt_toolkit/completion/base.py", line 262, in get_completions
return completer.get_completions(document, complete_event)
File "/home/ulidtko/.local/lib/python3.8/site-packages/pgcli/pgcompleter.py", line 485, in get_completions
matches.extend(matcher(self, suggestion, word_before_cursor))
File "/home/ulidtko/.local/lib/python3.8/site-packages/pgcli/pgcompleter.py", line 506, in get_column_matches
scoped_cols = self.populate_scoped_cols(tables, suggestion.local_tables)
File "/home/ulidtko/.local/lib/python3.8/site-packages/pgcli/pgcompleter.py", line 985, in populate_scoped_cols
cols = func.fields()
File "/home/ulidtko/.local/lib/python3.8/site-packages/pgcli/packages/parseutils/meta.py", line 168, in fields
for name, typ, mode in zip(self.arg_names, self.arg_types, self.arg_modes)

Exception 'NoneType' object is not iterable
Press ENTER to continue...
```

## Your environment
- [x] Please provide your OS and version information.
* Arch Linux
* PostgreSQL 11 from DockerHub, `docker pull postgres:11`
- [x] Please provide your CLI version.
* 3.0.0
- [x] What is the output of ``pip freeze`` command.
* is pretty long; I can provide specific dependency versions on request.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.