HSQLDB version 2.3.2.
problem with materialising subquery in exists-Clause when view is involved.
It seems the join-column-expression is not evaluated if it is not in the from-clause of the select.
It was working with hsqldb version 1.8.0.10 and earlier :-)
table setup
create table ViTa1 ( ViJoCo integer, ExtJoCo char(2), dat1 char(15));
create table ViTa2 ( ViJoCo integer, dat2 char(10));
create view vi as select vita1.dat1, vita1.extjoco, vita2.dat2 from ViTa1 join ViTa2 on ViTa1.vijoco = ViTa2.vijoco;
create table ExtJoTa (JoCo char(2), dat3 double);
insert into ViTa1 values (1, 'AA', 'viewbasetable');
insert into vita2 values (1, 'viewext');
insert into extjota values ('AA', 3.14);
-- not working (gives no result, should return the view-record)
select * from vi where exists(select '' from extjota where extjota.joco = vi.extjoco)
-- working (gives expected result)
select * from vi join extjota on vi.extjoco = extjota.joco
select * from vita1 where exists(select '' from extjota where extjota.joco = vita1.extjoco)
Fixed and committed to SVN.