"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
> The problem seems to be unbounded recursion in the makepol function that
> converts the input query from infix to polish notation. An easy fix
> would be to just add a level parameter to makepol that's incremented on
> each recursion, and throw an error if it grows bigger than some safe
> limit.
check_stack_depth() seems the correct fix.
regards, tom lane