summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIrina Truong <i.chernyavska@gmail.com>2018-07-25 08:30:34 -0700
committerGitHub <noreply@github.com>2018-07-25 08:30:34 -0700
commit688f09c0916841d16697bc71b474b878830a83f8 (patch)
tree37a97971fa08bc7b734d78baa379538b5b739458
parent9aae5ee34a38167a5eecc028d5bbf1fffa0596ab (diff)
parent05ec05c4cb4f3e28ac258190f02dd8b98c49ddb6 (diff)
Merge pull request #921 from lelit/pg11b2
Fix issue #919
-rw-r--r--changelog.rst7
-rw-r--r--pgcli/pgexecute.py20
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,