"Alexander H. Iliev" <iliev@nimbus.dartmouth.edu> writes:
> does anyone have a clue what this diagnostic from psql (v 7.0) means:
> ERROR: aggregate function in qual must be argument of boolean operator
Aggregates and GROUP BY in views have a lot of restrictions at the
moment, and this is one of them: the rewriter has a problem with
figuring out how to substitute "MAX(date)" for "last_payment.date"
in the context of your age() function call.
We're planning a thorough rewrite of the view-supporting code for 7.2,
and most of these problems should go away at that point. In the short
run you would be well advised to avoid grouped views except in the
simplest contexts. I think this example could be rewritten with no
view, or you could push the "date_part(...)" call into the view as
another column.
> oh, btw this select refused to use an SQL natural join among the 3
> relations - the server gives up and disconnects without warning.
That sounds like a garden-variety bug. I'd be willing to look at it
if I had a complete example to follow, but I don't want to try to
reverse-engineer your table definitions...
regards, tom lane