From 1ffaf5864ada1875f5e898ad4726c105dec21d9f Mon Sep 17 00:00:00 2001 From: Josha Inglis Date: Wed, 6 Jul 2022 09:57:16 +1100 Subject: [PATCH] include defaults in create function sig --- schemainspect/pg/obj.py | 12 ++++++++++-- schemainspect/pg/sql/functions.sql | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/schemainspect/pg/obj.py b/schemainspect/pg/obj.py index fe99108..eb2c911 100644 --- a/schemainspect/pg/obj.py +++ b/schemainspect/pg/obj.py @@ -246,6 +246,7 @@ def __init__( strictness, security_type, identity_arguments, + function_arguments, result_string, language, full_definition, @@ -254,6 +255,7 @@ def __init__( kind, ): self.identity_arguments = identity_arguments + self.function_arguments = function_arguments self.result_string = result_string self.language = language self.volatility = volatility @@ -280,6 +282,10 @@ def returntype_is_table(self): @property def signature(self): + return "{}({})".format(self.quoted_full_name, self.function_arguments) + + @property + def identity_signature(self): return "{}({})".format(self.quoted_full_name, self.identity_arguments) @property @@ -304,11 +310,12 @@ def thing(self): @property def drop_statement(self): - return "drop {} if exists {};".format(self.thing, self.signature) + return "drop {} if exists {};".format(self.thing, self.identity_signature) def __eq__(self, other): return ( - self.signature == other.signature + self.identity_signature == other.identity_signature + and self.signature == other.signature and self.result_string == other.result_string and self.definition == other.definition and self.language == other.language @@ -1561,6 +1568,7 @@ def load_functions(self): columns=od((c.name, c) for c in columns), inputs=plist, identity_arguments=f.identity_arguments, + function_arguments=f.function_arguments, result_string=f.result_string, language=f.language, definition=f.definition, diff --git a/schemainspect/pg/sql/functions.sql b/schemainspect/pg/sql/functions.sql index 471de77..57ad9ab 100644 --- a/schemainspect/pg/sql/functions.sql +++ b/schemainspect/pg/sql/functions.sql @@ -207,6 +207,7 @@ unnested as ( p.extension_oid as extension_oid, pg_get_function_result(p.oid) as result_string, pg_get_function_identity_arguments(p.oid) as identity_arguments, + pg_get_function_arguments(p.oid) as function_arguments, pg_catalog.obj_description(p.oid) as comment FROM unnested p