Subject Interesting results with joined views (WI-V6.2.972, fb1.0.3)
Author semprolbat
Hi.

I have a view that is made up of three different tables joined
together.

Stripped down to the essential fields, it looks a bit like:
create view v_a as
select a.id, a.mgrid, b.empid
from t_a a
left outer join t_c c on a.mgrid = c.mgrid
left outer join t_b b on b.empid = c.empid
;

In English: the view shows its base table a's values, and gets a
manager's employment ID from table b, based on mappings in table c.

What's funny is that with my production tables, I get results like
this:

select count(*) from v_a;
COUNT
============

21004

select count(*) from v_a where empid is null;
COUNT
============

21004

select count(*) from v_a where empid is not null;
COUNT
============

21004


The plan is:
PLAN JOIN (JOIN (V_A T INDEX (RDB$FOREIGN40),V_A O T NATURAL),
V_A A T NATURAL)

Am I doing something wrong, or is this behaviour documented
somewhere? Is the index messed up?

I tried reproducing this with a test case, but in the test case
everything works as expected.

Semp