Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > Note that it introduces a LEFT JOIN on pg_class to itself that's always
> > present, even for server versions that do not support reloptions.
>
> Personally I'd be more worried about the unnest(). Also, please
> schema-qualify that function name; you can't assume anything about
> the search path here.
This version should fix these issues. I refrained from adding more ? :
expressions because it starts getting ugly for my taste.