DB2 - Problembeschreibung
Problem IC77360 | Status: Geschlossen |
INCORRECT TRUTH VALUE FROM COMPARISON OF TIMESTAMP TO STRING HAVING HIGHER PRECISION THAN THE TIMESTAMP | |
Produkt: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problembeschreibung: | |
In V9.7 the precision of the timestamp operand in a comparison could be less than the number of fractional seconds in the string representation of a timestamp. Currently, the comparison uses the same precision as the timestamp operand, thus truncating even non-zero fractional seconds digits when converting the string representation to a timestamp. For example, the equality predicate TIMESTAMP '2010-08-18-15.20.25' = '2010-08-18-15.20.25.123' is TRUE because the left operand has a type of TIMESTAMP(0) and then converts the right operand to the same, losing the 3 fractional seconds digits before doing the comparison. The expected result in this case would be FALSE. Example of above current using a column: create table t1 (c1 timestamp(0)); insert into t1 values ('2010-08-18-15.20.25'); select c1 from t1 where c1 = '2010-08-18-15.20.25.123'; C1 ------------------- 2010-08-18-15.20.25 Comparisons that involve timestamp values are evaluated according to the following rules: - When comparing timestamp values with different precisions, the higher precision is used for the comparison and any missing digits for fractional seconds are assumed to be zero. - When comparing a timestamp value with a string representation of a timestamp, the string representation is first converted to TIMESTAMP(12). - Timestamp comparisons are chronological without regard to representations that might be considered equivalent. Thus, the following predicate is true: TIMESTAMP('1990-02-23-00.00.00') > '1990-02-22-24.00.00' | |
Problem-Zusammenfassung: | |
Local-Fix: | |
Explicitly cast string into a TIMESTAMP(p) | |
verfügbare FixPacks: | |
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows | |
Lösung | |
Workaround | |
keiner bekannt / siehe Local-Fix | |
Kommentar | |
This is a new requirement | |
Weitere Daten | |
Datum - Problem gemeldet : Datum - Problem geschlossen : Datum - der letzten Änderung: | 06.07.2011 19.01.2012 19.01.2012 |
Problem behoben ab folgender Versionen (IBM BugInfos) | |
Problem behoben lt. FixList in der Version | |
9.7.0.5 |