Ed Herrmann <ewherrmann@gmail.com> writes:
> This example does not cause the same error and returns results as expected.
> If it has to do with the execution plan as Laurenz suggested, do you have a
> suggestion on how to better create a self-contained example where it would
> behave more like an actual table select to get the desired list of keys?
Do an EXPLAIN on the problem query, and then try to make an example
with no private data that shows the same plan.
regards, tom lane