home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IT03178 Status: Closed

DB2LOOK WITH -CT CANNOT ORDER CONSTRAINT DDLS BY CREATION TIME, AS TABLE
CONSTRAINTS DO NOT KEEP CREATION TIME IN CATALOG VIEW

product:
DB2 FOR LUW / DB2FORLUW / A50 - DB2
Problem description:
When adding a UNIQUE constraint UC on two columns C1, C2 to 
which already an index IX(C2, C1) exists that index is re-used. 
This is an accepted DB2 feature and can be argued to be 
semantically correct. 
 
If the order of creation of UC and IX is reversed then the index 
UC(C1, C2) will be created to support UC as well as IX. This too 
is correct as the index serves a purpose for performance. 
 
As schema that does require "reverse order" (or similar) indexes 
to supplement defined constraints is therefore dependent on 
correct ordering of object creation. 
 
db2look however does not observe creation order for indexes and 
constraints, despite -ct (sort by create time) being specified. 
 
The cause is, table constraint does not have creation time 
recorded in catalog view, db2look -CT can not order these 
constraint DDLs by creation_time, so just print the DDLs at the 
bottom of the script. 
 
Repro Script: 
 
db2 create db test 
db2 connect to test 
db2 "create table t(c1 int not null, c2 int not null)" 
db2 "alter table t add constraint u1 unique (c1, c2)" 
db2 "create unique index i1 on t(c2, c1)" 
db2 terminate 
 
Repro Output: 
 
$ db2look -d test -ct -e -u user 
-- Creating DDL for table(s) 
-- This CLP file was created using DB2LOOK Version "10.5" 
-- Timestamp: Tue 24 Jun 2014 09:47:08 AM EDT 
-- Database Name: TEST 
-- Database Manager Version: DB2/LINUXX8664 Version 10.5.4 
-- Database Codepage: 1208 
-- Database Collating Sequence is: IDENTITY 
-- Alternate collating sequence(alt_collate): null 
-- varchar2 compatibility(varchar2_compat): OFF 
 
-- Binding package automatically ... 
-- Bind is successful 
-- Binding package automatically ... 
-- Bind is successful 
 
CONNECT TO TEST; 
 
 
CREATE SCHEMA "USER" ; 
 
 
CREATE TABLE "USER"."T"  ( 
                  "C1" INTEGER NOT NULL , 
                  "C2" INTEGER NOT NULL ) 
                 IN "USERSPACE1" 
                 ORGANIZE BY ROW  ; 
 
 
CREATE UNIQUE INDEX "USER"."I1" ON "USER "."T" 
                ("C2" ASC, 
                 "C1" ASC) 
 
                COMPRESS NO 
                INCLUDE NULL KEYS ALLOW REVERSE SCANS ; 
 
 
ALTER TABLE "USER"."T" 
        ADD CONSTRAINT "U1" UNIQUE 
                ("C1", 
                 "C2") ; 
 
 
COMMIT WORK; 
 
CONNECT RESET; 
 
TERMINATE;
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 Version 10.5 Fix Pack 5                       * 
****************************************************************
Local Fix:
Upgrade to 10.5 fp5
Solution
First Fixed in Version 10.5 Fix Pack 5
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
15.07.2014
31.03.2015
31.03.2015
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
10.5.0.5 FixList