"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> The simplified query is preferred so long as it produces the error - but
> you really should be providing the create table commands to make the entire
> script self-contained.
Yeah, it's impossible to reproduce or investigate this without
table definitions ... and I for one don't feel like guessing at
the table details.
regards, tom lane