1
0
Fork 0

Adapt the query used to get functions metadata to PG11

This fixes #919.
This commit is contained in:
Lele Gaifax 2018-07-24 17:47:35 +02:00
parent 6a18b6d0e3
commit 05ec05c4cb
2 changed files with 20 additions and 1 deletions

View File

@ -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
======

View File

@ -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,