"Mauricio da Silva Barrios" <typedeath@zipmail.com.br> writes:
> mydb=> CREATE VIEW connection_last AS
> SELECT * FROM connection as con_out
> WHERE connection_start IN ( SELECT max(connection_start) FROM
> connection as con_in
> WHERE con_in.connection_owner =
> con_out.connection_owner
> GROUP BY connection_owner);
> mydb=> select * from connection_last;
> pqReadData() -- backend closed the channel unexpectedly.
Hmm. Seems to work fine in current sources:
regression=# select * from connection_last;connection_id | connection_owner | connection_start | connection_end
---------------+------------------+------------------------+---------------- 3 | 2 |
2001-01-2200:00:00-05 | 00:02:02
(1 row)
I seem to recall that the rule rewriter had some problems dealing with
aggregate functions inside sub-selects in 6.5.*, and that's probably
what's causing your problem.
7.0 is scheduled to go beta next week, so I'd suggest picking up
a beta copy ...
regards, tom lane