Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> 10046 trace buggy with deferred constraints
I turned on tracing to track an application bug and found what looks to be
an Oracle bug (though Oracle doesn't think so quite yet). Here is my simple
test case. I created a Parent table with two Child tables referencing the
parent, Child_imm had a deferred constraint (which was never deferred) and
Child_def had an initially deferred constraint. I left the parent table
empty in order to generate a FK constraint error (ORA-2291). When I inserted
a row into Child_imm, I immediately got the ORA-2291 error. This also
appeared in the trace file. When I inserted a row into Child_def, it
inserted successfully (as expected). On commit, it rolled_back and gave me
the ORA-2291. When I looked at the trace file, however, it looked as though
the insert was successful (no error, EXEC for the insert had r=1, and the
commit (XCTEND rlbk=0, rd_only=0) succeeded).
I've seen this on 10.1.0.3 and 10.2.0.2 on RedHat (the 10.2 is AS4)
SQL> CREATE TABLE parent (p_id number constraint PARENT_P_ID PRIMARY KEY ) 2 /
Table created.
SQL>
SQL> CREATE TABLE child_imm (c_id number constraint CHILD_IMM_C_ID PRIMARY
KEY,
2 c_p_id number constraint FK_P_ID_IMM references
parent(p_id) DEFERRABLE)
3 /
Table created.
SQL> CREATE TABLE child_def (c_id number constraint CHILD_DEF_C_ID PRIMARY
KEY,
2 c_p_id number constraint FK_P_ID_DEF references
parent(p_id) INITIALLY DEFERRED)
3 /
Table created.
SQL> SQL> SQL> SQL> ALTER SESSION SET EVENTS '10046 trace name context forever, level 12';
Session altered.
SQL>
SQL> INSERT INTO child_imm VALUES (5,5);
INSERT INTO child_imm VALUES (5,5)
*
ERROR at line 1:
ORA-02291: integrity constraint (HENRY.FK_P_ID_IMM) violated - parent key
not
found
SQL> COMMIT; Commit complete.
PARSING IN CURSOR #6 len=34 dep=0 uid=28 oct=2 lid=28 tim=1143861822500419
hv=1593902885 ad='784dccc8'
INSERT INTO child_imm VALUES (5,5)
END OF STMT
PARSE
#6:c=10000,e=9049,p=0,cr=4,cu=0,mis=1,r=0,dep=0,og=1,tim=1143861822500407
BINDS #6:
bfp=40a6bbb8 bln=22 avl=04 flg=05
value=26355
EXEC #3:c=0,e=1469,p=0,cr=0,cu=0,mis=1,r=0,dep=1,og=4,tim=1143861822505797
FETCH #3:c=0,e=85,p=0,cr=5,cu=0,mis=0,r=1,dep=1,og=4,tim=1143861822505941
...
EXEC
#6:c=10000,e=5816,p=0,cr=6,cu=31,mis=0,r=0,dep=0,og=1,tim=1143861822506359
ERROR #6:err=2291 tim=182992045
...
SQL> INSERT INTO child_def VALUES (6,6);
1 row created.
SQL> COMMIT;
COMMIT
*
ERROR at line 1:
ORA-02091: transaction rolled back
ORA-02291: integrity constraint (HENRY.FK_P_ID_DEF) violated - parent key
not
found
SQL>
SQL> ALTER SESSION SET EVENTS '10046 trace name context off';
Session altered.
SQL>
SQL> exit
PARSE #12:c=0,e=70,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=1143861822512280 XCTEND rlbk=0, rd_only=0hv=1395529870 ad='7c061ffc'
=====================
PARSING IN CURSOR #13 len=80 dep=1 uid=0 oct=3 lid=0 tim=1143861822512555
bfp=409dbd2c bln=22 avl=04 flg=05
value=26357
EXEC #13:c=0,e=181,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1143861822512883
FETCH #13:c=0,e=87,p=0,cr=5,cu=0,mis=0,r=1,dep=1,og=4,tim=1143861822513010
...
Henry
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Feb 13 2007 - 15:52:16 CST
![]() |
![]() |