Skip to content

Commit

Permalink
Conditionally inject dependencies of functions
Browse files Browse the repository at this point in the history
For some functions, it is possible that the functions it depends
upon are not explicitly present, e.g. for the following aggregate
function:

CREATE AGGREGATE array_agg_mult(anyarray) (
    SFUNC = array_cat,
    STYPE = anyarray,
    INITCOND = '{}'
);

We got the following error when trying to dbtoyaml this database

KeyError: (u'public', 'array_cat', u'anyarray, anyarray'), but
the dependency is upon pg_catalog.array_cat, so should not even be
made explicit.
  • Loading branch information
Feike Steenbergen committed May 17, 2018
1 parent 167cf2a commit f1dac66
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyrseas/dbobject/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,8 @@ def get_implied_deps(self, db):
args = self.arguments.replace(' ORDER BY', ',')
else:
args = self.stype + ', ' + self.arguments
deps.add(db.functions[sch, fnc, args])
if (sch, fnc, args) in db.functions:
deps.add(db.functions[sch, fnc, args])
for fn in ('finalfunc', 'mfinalfunc'):
if getattr(self, fn) is not None:
func = getattr(self, fn)
Expand Down

0 comments on commit f1dac66

Please sign in to comment.