Closed maheshm closed 4 years ago
WHERE pn.nspname = 'public' AND pd.objid IS null and pp.prosrc != 'aggregate_dummy'
This seems to work for me, but not sure how this will behave in non-postgis DB.
It will be great if someone can help me test the above on normal Postgres and I can raise a PR with the above change
WHERE pn.nspname = 'public' AND pd.objid IS NULL AND pp.prokind != 'a'
I’d happily welcome a PR that fixes the error
@teoljungberg just created one :)
So it's ready for various versions of PG now.
So, we don't have postgis, but we do have aggregate functions, and I can confirm the current query doesn't work, but adding AND pp.prokind != 'a'
seems to dump it fine.
What's the general testing protocol for a change like this?
Another option btw would be AND pp.prokind = 'f'
https://www.postgresql.org/docs/11/catalog-pg-proc.html
According to this:
f
for a normal function,p
for a procedure,a
for an aggregate function, orw
for a window function
However I'm not sure the scope of this gem (if it should dump things other than normal functions)
Sorry for the multiple messages. It should also be noted that pg_proc.prokind
is only available on Postgres 11+
@bradrobertson The opened PR should resolve the issue on postgres 10 and 11. I hope.
Can you shed any light on this @vladimirtemnikov ?
@teoljungberg I'm sure it's the same problem which my PR resolves. I'll try to finish PR soon.
This seems to be fixed by #50.
https://github.com/teoljungberg/fx/blob/53f8b3fb651e7574f98f6ff3685361a13de0981c/lib/fx/adapters/postgres/functions.rb#L11
This throws the following error if you have aggregate functions (Postgis has a lot of these):
Stacktrace if that helps:
Basically
pg_get_functiondef()
fails for aggregate functions.