Icon View Incident Report

Serious Serious
Reported By: Clive Bennett
Reported On: 12/13/2004
For: Version 4.15 Build 1
# 1914 Phantom Values May Show Up in a Query Result Set for a Joined Query

In v4.15 this query below has unexpected results, b.item_value has a null value where it returns a value correctly in v4.12.
If I move the b.type = 'S' from the outer join to the where clause the query returns the correct results, however the outer join doesnt work, ie effectively makes it a inner join.

drop table if exists "\memory\bal_items";

select  
  sum(value) as item_value,
  period,
  type,
  scenario_code,
  project_code 
into 
  "\memory\bal_items" 
from  
  rpt_balance_sheet_variable_items 
where 
  type in ('I','T','S','N','F') and 
  scenario_code = -2 group by period,type,scenario_code,project_code;

create index idx_1 on "\memory\bal_items" (type);

select  
  46,period,scenario_code,'Shareholder funds',b.item_value, coalesce(b.
item_value,0.0) + c.value + a.value + s.value as value,project_code 
from  
  rpt_generic_detail c 
  inner join rpt_generic_detail a on a.period = c.period and a.
scenario_code = c.scenario_code  
  inner join rpt_generic_detail s on s.period = c.period and s.
scenario_code = c.scenario_code  
  LEFT OUTER JOIN "\memory\bal_items" b on b.period = c.period and b.
type = 'S' 
where 
  c.rowid = 28 and 
  a.rowid = 29 and 
  s.rowid = 30 and 
  c.scenario_code =-2;



Comments Comments
An addition in 4.15 was causing expression tokens to not be initialized properly. This would cause phantom values to show up in the generated rows in the result set.


Resolution Resolution
Fixed Problem on 12/19/2004 in version 4.16 build 1
Image