DB2 - Problembeschreibung
| Problem IC71254 | Status: Geschlossen |
POSSIBLE INCORRECT RESULT ON RECURSIVE VIEWS JOIN TO A TABLE ON UNIQUE COLUMN | |
| Produkt: | |
DB2 FOR LUW / DB2FORLUW / 980 - DB2 | |
| Problembeschreibung: | |
An SQL statement with a recursive view using UNION ALL that
joins to a table on a set of columns that forms a unique key may
return incorrect results.
For example:
CREATE TABLE RELATION(ID INTEGER, PARENTID INTEGER, FLAG
CHAR(1));
-- This unique index is required to produce the incorrect
results output
CREATE UNIQUE INDEX UK1 ON RELATION(ID);
CREATE VIEW HIRARCHY(ID, PARENTID, DEPTH)
AS
WITH TREE
(ID, PARENTID, DEPTH) AS
(SELECT ID, PARENTID, 1 AS DEPTH FROM RELATION ROOT
UNION ALL
SELECT CHILD.ID, TREE.PARENTID, DEPTH+1 FROM TREE, RELATION
CHILD WHERE TREE.ID = CHILD.PARENTID)
SELECT * FROM TREE
;
INSERT INTO RELATION VALUES (1,2,'Y'),(2,3,'N');
SELECT H.ID, H.PARENTID, DEPTH
FROM HIRARCHY H,RELATION R
WHERE H.ID = R.ID
AND R.FLAG = 'Y';
The correct result is 2 rows.
ID PARENTID DEPTH
----------- ----------- -----------
1 2 1
1 3 2
DB2 incorrectly returns only the first row. This problem is
first introduced in DB2 version 9.5 Fix Pack 6 and 9.7 Fix
Pack 3. | |
| Problem-Zusammenfassung: | |
**************************************************************** * USERS AFFECTED: * * All DB2 users * **************************************************************** * PROBLEM DESCRIPTION: * * As described in the APAR problem description section. * **************************************************************** * RECOMMENDATION: * * Upgrade to V9.8 FP1. * **************************************************************** | |
| Local-Fix: | |
db2set DB2COMPOPT=x,65536+y where x and y are the values currently set in the system. and restart the DB2 instance | |
| verfügbare FixPacks: | |
DB2 Version 9.8 Fix Pack 4 for AIX and Linux | |
| Lösung | |
The problem was fixed in V9.8 FP4. | |
| Workaround | |
keiner bekannt / siehe Local-Fix | |
| Weitere Daten | |
Datum - Problem gemeldet : Datum - Problem geschlossen : Datum - der letzten Änderung: | 17.09.2010 29.07.2011 29.07.2011 |
| Problem behoben ab folgender Versionen (IBM BugInfos) | |
9.8.FP1, 9.8.FP4 | |
| Problem behoben lt. FixList in der Version | |
| 9.8.0.4 |
|