pinker <pinker(at)onet(dot)eu> writes:
> I've changed all name data types to text and running a query on a simple
> table with another function and it is still crashing :/
> yeah, removing ORDER BY helps here also...
Hard to comment on that when you haven't shown an example.
Anyway, I've identified the issue with the presented example and pushed
a fix. If you're in a position to rebuild Postgres locally you could
try applying
https://git.postgresql.org/gitweb/?p=postgresql.git;a=patch;h=25378db74fd97f2b10ad44d1f0b2e1f8b0a651f2
and see whether it takes care of all the cases you noticed.
regards, tom lane