Article View: borland.public.interbase.sql
Article #271Re: Joining stored procs in a query gives different results in IB 2007 and IB 7.5
From: Kjell Ljungqvist
Date: Tue, 12 Feb 2008 08:42
Date: Tue, 12 Feb 2008 08:42
118 lines
4340 bytes
4340 bytes
Should I expect any comments on this in either QC or here? As I see it this is a rather serious change in behaviour (a bug) and it is actually one of the first times that we have to go through our code and change something that has worked perfectly earlier but stops working when the customer site is upgraded to IB 2007 SP2. Regards, Kjell "Kjell Ljungqvist" <kjell@REMOVETHIS.iki.fi> wrote in message news:47ac96dc@newsgroups.borland.com... > Yes. The results below are with IB 2007 SP2. > > /Kjell > > > "Quinn Wildman (CodeGear Developer Support)" > <qwildman@nospam.codegear.com> wrote in message > news:47ac873d$1@newsgroups.borland.com... >> For InterBase 2007, do you have SP2? >> >> Kjell Ljungqvist wrote: >>> I entered this report into QC a few days ago (57839). No comments have >>> been made there yet so I thought I would like to here from you guys here >>> in the NG. Any comments on this? This change in behaviour between IB2007 >>> and earlier versions of IB (tested with IB 7.5 and IB 5.6) has caused as >>> a number of unpleasent experiences already. >>> >>> When using "left join" to a stored proc in a select statement with IB >>> 2007 the result set differs (see the NULL values in section 4 below) >>> from the result set that IB 7.x and IB 5.6 gives. In the example given >>> here it seems like only the last record in the dataset contains the >>> correct information from the SP. Hence queries that give only one record >>> back are correct in IB 2007 too (section 5 below). >>> >>> Regards, >>> Kjell >>> >>> * * * * * >>> >>> 1. TABLE AND SP SETUP >>> ------------------------------------------- >>> CREATE TABLE TEST_DATA ( >>> ID INTEGER NOT NULL, >>> QTY INTEGER, >>> QTY2 INTEGER >>> ); >>> >>> ALTER TABLE TEST_DATA ADD CONSTRAINT PK_TEST_DATA PRIMARY KEY (ID); >>> >>> CREATE PROCEDURE IS_EQUAL( >>> PLINK_ID INTEGER, >>> PVALUE1 INTEGER, >>> PVALUE2 INTEGER >>> ) >>> RETURNS ( >>> R_LINK_ID INTEGER, >>> R_EQUAL CHAR(1) >>> ) >>> AS >>> BEGIN >>> R_LINK_ID=PLINK_ID; >>> if (PVALUE1=PVALUE2) then >>> R_EQUAL='T'; >>> else >>> R_EQUAL='F'; >>> suspend; >>> end >>> >>> >>> 2. TESTDATA >>> ------------------------- >>> INSERT INTO TEST_DATA (ID, QTY, QTY2 ) VALUES (1, 0, 0); >>> INSERT INTO TEST_DATA (ID, QTY, QTY2 ) VALUES (2, 1, 0); >>> INSERT INTO TEST_DATA (ID, QTY, QTY2 ) VALUES (3, 0, 1); >>> >>> >>> 3. QUERY >>> ----------------- >>> select * from TEST_DATA T >>> LEFT JOIN IS_EQUAL(T.ID,T.QTY,T.QTY2) CD >>> ON CD.R_LINK_ID=T.ID >>> >>> >>> 4. RESULTS >>> --------------------- >>> IB 2007: >>> ID QTY QTY2 R_LINK_ID R_EQUAL >>> 1 0 0 NULL NULL >>> 2 1 0 NULL NULL >>> 3 0 1 3 F >>> >>> >>> IB 7.5 >>> ID QTY QTY2 R_LINK_ID R_EQUAL >>> 1 0 0 1 T >>> 2 1 0 2 F >>> 3 0 1 3 F >>> >>> >>> 5. SINGLETON QUERY >>> -------------------------------------- >>> select * from TEST_DATA T >>> LEFT JOIN IS_EQUAL(T.ID,T.QTY,T.QTY2)CD ON CD.R_LINK_ID=T.ID >>> where T.ID=2 >>> >>> IB 2007: >>> ID QTY QTY2 R_LINK_ID R_EQUAL >>> 2 1 0 2 F >>> >>> IB 7.5 >>> ID QTY QTY2 R_LINK_ID R_EQUAL >>> 2 1 0 2 F >>> >>> >>> * * * * * >>> >
Technical Details
Message-ID:
<47b15c11@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<47ab755a@newsgroups.borland.com> <47ac873d$1@newsgroups.borland.com> <47ac96dc@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,6d404279065eef77 X-Google-Attributes: gid114a0e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Kjell Ljungqvist" <kjell@REMOVETHIS.iki.fi> Newsgroups: borland.public.interbase.sql References: <47ab755a@newsgroups.borland.com> <47ac873d$1@newsgroups.borland.com> <47ac96dc@newsgroups.borland.com> Subject: Re: Joining stored procs in a query gives different results in IB 2007 and IB 7.5 Date: Tue, 12 Feb 2008 10:42:56 +0200 Lines: 120 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 213.250.81.14 Message-ID: <47b15c11@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1202805777 213.250.81.14 (12 Feb 2008 00:42:57 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail