This crashes v6.4, too.
--------------------------------------------------------------------
=> -- make table xxx, insert some values
create table xxx (
date1 date,
date2 date,
id smallint
);
CREATE
=> insert into xxx values ('01.01.1999', '15.01.1999', 1);
INSERT 69451 1
insert into xxx values ('01.01.1999', '15.01.1999', 1);
INSERT 69452 1
insert into xxx values ('01.01.1999', '15.01.1999', 1);
INSERT 69453 1
insert into xxx values ('01.01.1999', '15.01.1999', 1);
INSERT 69454 1
=> -- same for table yyy
create table yyy (
date_join date,
id_join smallint,
some_value float8
);
CREATE
=> insert into yyy values ('01.01.1999', 1, 1.21);
INSERT 69466 1
insert into yyy values ('01.01.1999', 1, 1.22);
INSERT 69467 1
insert into yyy values ('01.01.1999', 1, 1.23);
INSERT 69468 1
insert into yyy values ('01.01.1999', 1, 1.24);
INSERT 69469 1
=> -- make view
create view xxx1 as
select date1, date2, id,
count(id)*(date2-date1) as q
from xxx
group by date1, date2, id;
CREATE
=> -- that does work now:
select * from xxx1;
date1| date2|id| q
----------+----------+--+--
01-01-1999|01-15-1999| 1|56
(1 row)
=> -- this not (v6.4)
select date1, sum(some_value)/q
from xxx1, yyy
where date1 = date_join and
id = id_join
group by date1, q;
pqReadData() -- backend closed the channel unexpectedly. This
probably means the backend terminated abnormally before or
while processing the request. We have lost the connection
to the backend, so further processing is impossible.
Terminating.
--------------------------------------------------------------------
-- crash!
select date1, sum(some_value), q
from xxx1, yyy
where date1 = date_join and
id = id_join
group by date1;
-- crash!
select date1, q
from xxx1, yyy
where date1 = date_join and
id = id_join
group by date1,q;
-- doesn't crash
select date1, sum(some_value)
from xxx1, yyy
where date1 = date_join and
id = id_join
group by date1;
----------------------------------------------------------------------
Hmmm.
Ulf
--
======================================================================
%%%%% Ulf Mehlig <ulf.mehlig@uni-bremen.de>
%%%%!%%% Projekt "MADAM" <umehlig@uni-bremen.de>
%%%% %!% %%%% ----------------------------------------------------
---| %%% MADAM: MAngrove | Center for Tropical Marine
||--%!% Dynamics | Biology
|| And | Fahrenheitstrasse 1
_ /||\_/\_ Management |
/ / \ \ ~~~~~~~~~~~~~~~~~ | 28359 Bremen/Germany
~~~~~~~~~~~~~~~~~~~~