diff options
-rw-r--r-- | changelog.rst | 7 | ||||
-rw-r--r-- | pgcli/pgexecute.py | 20 |
2 files changed, 23 insertions, 4 deletions
diff --git a/changelog.rst b/changelog.rst index 0ac3e5ad..f2dc938f 100644 --- a/changelog.rst +++ b/changelog.rst @@ -5,6 +5,7 @@ Bug fixes: ---------- * Fix for error retrieving version in Redshift (#922). (Thanks: `Irina Truong`_) +* Adapt the query used to get functions metadata to PG11 (#919). (Thanks: `Lele Gaifax`_). 1.10.2 ====== @@ -244,7 +245,7 @@ Bug Fixes: * Fix scoping for columns from CTEs. (Thanks: `Joakim Koljonen`_) * Fix crash after `with`. (Thanks: `Joakim Koljonen`_). -* Fix issue #603 (`\i` raises a TypeError). (Thanks: `Emanuele Gaifas`_). +* Fix issue #603 (`\i` raises a TypeError). (Thanks: `Lele Gaifax`_). Internal Changes: @@ -280,7 +281,7 @@ Bug Fixes: * Fix crash bug with leading parenthesis. (Thanks: `Joakim Koljonen`_). * Remove cumulative addition of timing data. (Thanks: `Amjith Ramanujam`_). * Handle unrecognized keywords gracefully. (Thanks: `Darik Gamble`_) -* Use raw strings in regex specifiers. This preemptively fixes a crash in Python 3.6. (Thanks `Emanuele Gaifas`_) +* Use raw strings in regex specifiers. This preemptively fixes a crash in Python 3.6. (Thanks `Lele Gaifax`_) Internal Changes: ----------------- @@ -844,7 +845,7 @@ Improvements: .. _`Fabien Meghazi`: https://github.com/amigrave .. _`Manuel Barkhau`: https://github.com/mbarkhau .. _`Sergii`: https://github.com/foxyterkel -.. _`Emanuele Gaifas`: https://github.com/lelit +.. _`Lele Gaifax`: https://github.com/lelit .. _`tk`: https://github.com/kanet77 .. _`Owen Stephens`: https://github.com/owst .. _`Russell Davies`: https://github.com/russelldavies diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py index 0d55ab01..8bcc5c63 100644 --- a/pgcli/pgexecute.py +++ b/pgcli/pgexecute.py @@ -618,7 +618,25 @@ class PGExecute(object): def functions(self): """Yields FunctionMetadata named tuples""" - if self.conn.server_version > 90000: + if self.conn.server_version >= 110000: + query = ''' + SELECT n.nspname schema_name, + p.proname func_name, + p.proargnames, + COALESCE(proallargtypes::regtype[], proargtypes::regtype[])::text[], + p.proargmodes, + prorettype::regtype::text return_type, + p.prokind = 'a' is_aggregate, + p.prokind = 'w' is_window, + p.proretset is_set_returning, + pg_get_expr(proargdefaults, 0) AS arg_defaults + FROM pg_catalog.pg_proc p + INNER JOIN pg_catalog.pg_namespace n + ON n.oid = p.pronamespace + WHERE p.prorettype::regtype != 'trigger'::regtype + ORDER BY 1, 2 + ''' + elif self.conn.server_version > 90000: query = ''' SELECT n.nspname schema_name, p.proname func_name, |