Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Ingres Topics / January 2005

Tip: Looking for answers? Try searching our database.

[Info-ingres] views in outer joins

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
martin.bowes@ctsu.ox.ac.uk - 19 Jan 2005 15:28 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.