Hi Dudes,
II2.5 axp.osf
Can you use views in outer joins? I would have assumed so.
But I have a case where I use a view and a left outer join to
replace a not exists style query. Its syntactically okay but produces a
wrong result.
If I replace the view with a table generated from the view. The
left outer join works correctly.
If I use the view with the equivelent not exists query the correct
result is generated.
Query with view is:
select count(*)
from profile_map_node_others pmv left outer join descriptor_value
dv
on pmv.value_id=dv.value_id
where pmv.value_id != 0 and
pmv.profile_map_id=1422726 and dv.value_id is null;
(Which incorrectly returns 0)
Query with not exists is:
select count(*)
from profile_map_node_others pmv
where pmv.value_id != 0 and
pmv.profile_map_id=1422726 and
not exists (
select 1 from descriptor_value dv
where pmv.value_id=dv.value_id
);
(Which returns the correct answer 1)
And the table equivalent is:
create table fred as select * from profile_map_node_others;
select count(*)
from fred pmv left outer join descriptor_value dv
on pmv.value_id=dv.value_id
where pmv.value_id != 0 and
pmv.profile_map_id=1422726 and dv.value_id is null;
(Which returns the correct answer 1)
Have I stuffed something up?
Martin Bowes
--
Random Farscape Quote #3:
John - If this is part of some sick experiment, I'm going to bill them for
the therapy.
BAMfromTheBurg@netscape.net - 19 Jan 2005 19:05 GMT
No, you haven't "stuffed" anything. These symptons are similar to
issue we had. These queries producing bad results was one of the
reasons we skipped 2.5. Testing showed that complicated outer joins
with viewd cause unrealiable resutls. CA has since fixed the issue.
You might want to check if they have a patch for AX 2.5. We moved to
Ingres 2.6 patch 10523 on HPUX 11.11 (from 2.0) and testing revealed no
issues. The patch documentation for 10523 has numerous mentions of
"Problems addressed in this patch" related to complicated outer join
queries (outer joins with views, outer joins with nulls, outer joins
with views that are composed of outer join) producing incorrect results.
martin.bowes@ctsu.ox.ac.uk - 20 Jan 2005 13:46 GMT
Hi Bam and Karl et al,
Thanks dudes, I suspected that it had to be. But I have to
confess to being a little wary of my SQL on outer joins.
No chance of an upgrade in the forseeable future. I'll see if I
can get a patch.
Marty
> No, you haven't "stuffed" anything. These symptons are similar to
> issue we had. These queries producing bad results was one of the
[quoted text clipped - 6 lines]
> queries (outer joins with views, outer joins with nulls, outer joins
> with views that are composed of outer join) producing incorrect results.
--
Random Duckman Quote #43:
Duckman - Should olives squeal?