Bug Hunting

Doug's Oracle Blog

  • Home
  • Papers
  • Books
  • C.V.
  • Fun
  • Oracle Blog
  • Personal Blog

Dec 18: Bug Hunting

It's early days but I think I became the joint father of a bug report this week. This is bug number 9219636.


SQL> CREATE TYPE INTEGER_ARRAY_T AS TABLE OF INTEGER
  2  /

Type created.

SQL> 
SQL> CREATE TABLE V_SESSION_VALID (
  2          SID NUMBER ,
  3          SESSION_ID NUMBER NOT NULL,
  4                  CONSTRAINT SID_PK PRIMARY KEY (SID) VALIDATE ,
  5                  CONSTRAINT SESSIONID_UK UNIQUE (SESSION_ID) VALIDATE)
  6  /

Table created.

SQL> 
SQL> CREATE TABLE SESSION_VIEW ( VIEW_ID NUMBER ,
  2          SESSION_ID NUMBER NOT NULL,
  3          ROW_COUNT NUMBER NOT NULL,
  4                  CONSTRAINT VIEWID_PK PRIMARY KEY (VIEW_ID) VALIDATE)
  5  /

Table created.

SQL> 
SQL> CREATE TABLE BATCH_SESSION (BATCH_ID NUMBER NOT NULL , ROW_ID NUMBER NOT NULL , 
                                 SID NUMBER NOT NULL )
  2  /

Table created.

SQL> 
SQL> declare
  2          l_sessions INTEGER_ARRAY_T;
  3  begin
  4          select s.SESSION_ID
  5          bulk collect into l_sessions
  6          from V_SESSION_VALID s
  7                  join SESSION_VIEW v on (s.SESSION_ID = v.SESSION_ID)
  8                  join BATCH_SESSION b on (s.SID = b.SID)
  9          where  v.ROW_COUNT > 0
 10          and b.BATCH_ID between 1 and 1000
 11          for update of s.SESSION_ID;
 12  end;
 13  /
        select s.SESSION_ID
        *
ERROR at line 4:
ORA-06550: line 4, column 2:
PL/SQL: ORA-00918: column ambiguously defined
ORA-06550: line 4, column 2:
PL/SQL: SQL Statement ignored


This works in all versions prior to 11.2.0.1, which is where it was identified during some 11gR2 RAC testing of the application I'm working on. There are actually quite a few notes about this type of error kicking around on My Oracle Support, but in most cases they aren't bugs, but a tightening of ambiguous column checking, which is a good thing. However, if your app does use ANSI join syntax, keep an eye out for 11gR2 catching out previously suspect SQL statements when you're upgrading.

However, there is no ambiguous column definition here. If I convert it to traditional Oracle join syntax, it works, as does commenting out the offending part of the code.

SQL> declare   2          l_sessions INTEGER_ARRAY_T;   3  begin   4          select s.SESSION_ID   5          bulk collect into l_sessions   6          from V_SESSION_VALID s   7                  join SESSION_VIEW v on (s.SESSION_ID = v.SESSION_ID)   8                  join BATCH_SESSION b on (s.SID = b.SID)   9          where  v.ROW_COUNT > 0  10          and b.BATCH_ID between 1 and 1000;  11  -- for update of s.SESSION_ID;  12  end;  13  / PL/SQL procedure successfully completed.


So why do I say joint father of the bug report? Because having raised the SR, we delayed our 11gR2 upgrade work for unassociated reasons and so I didn't put the work in to provide the proper test case that Oracle Support requested. A couple of weeks later, with the SR abandoned for now, one of the DBAs mentioned a bug he'd found on 11gR2 and my first question was 'ANSI join syntax?'. Sure enough, it was the same as our example so he picked up the SR and ran with it and put together the test case here, which is also stripped of any company information. So we might have hit it first, but Cristian Banoiu put in the hard work. I'm sure he was pretty proud when it was assigned a bug number and I believe it's currently in development.
Posted by Doug Burns Comments: (8) Trackback: (1)

Trackbacks
Trackback specific URI for this entry

PingBack
Weblog: coskan.wordpress.com
Tracked: Jan 02, 17:50

Comments
Display comments as (Linear | Threaded)

#1 - Dominic Brooks said:
2009-12-19 08:34 - (Reply)

So the moral of the story is don't use the ANSI join syntax? ;-)

#1.1 - Doug Burns said:
2009-12-19 09:42 - (Reply)

:-)

I almost made that point but then I was conscious that I didn't want to write something that might cause people to avoid it forever! Having posted about what I like about ANSI join syntax in the past, though, the single biggest reason I don't use it is I've run out of the number of related bugs I've seen mentioned in release notes!

#1.1.1 - Tom Underhill 2010-01-08 10:47 - (Reply)

here's another 11.2 one for you which I discovered yesterday

drop table table1;
drop table table2;
create table table1 ( id number, text1 varchar2(30),text2 varchar(30) );
create table table2 ( id number, text1 varchar2(30),text2 varchar(30) );

SELECT table1.rowid
FROM table1
JOIN table2 t2 ON table1.id = t2.id
FOR UPDATE OF table1.text1,table1.text2;

This query will hang for infinity and cause the cpu to go through the roof, it won't respond to cntl-c and you have to kill the server process. It only occues if you're using ansi join syntax and more than 1 column in the FOR UPDATE OF clause - workaround ? you guessed it - don't use ansi join syntax. I'm now an expectant father of an oracle bug !

#1.1.1.1 - Doug Burns said:
2010-01-09 10:41 - (Reply)

Cool - thanks.

I feel a new acronym coming on - YAAJSB.

Yet another ANSI Join Syntax bug ;-)

#2 - Doug Burns said:
2010-02-12 08:51 - (Reply)

UPDATE: Confirmed as a bug and fixed in 11.2.0.2

#2.1 - Peter Wiseman 2010-02-24 04:49 - (Reply)

Do you have a BUG# for us?

#2.1.1 - Doug Burns said:
2010-02-24 06:15 - (Reply)

As stated in the post above, it's bug number 9219636. Confirmed by just looking it up. If you can't see it perhaps it's some MOS issue

https://support.oracle.com/CSP/main/article?cmd=show&type=BUG&id=9219636&productFamily=Oracle

#3 - Doug Burns said:
2010-04-16 04:46 - (Reply)

One-off patch 9219636 has now been published for this.


Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
BBCode format allowed
 
 

Statistics on Partitioned Tables

Contents

Part 1 - Default options - GLOBAL AND PARTITION
Part 2 - Estimated Global Stats
Part 3 - Stats Aggregation Problems I
Part 4 - Stats Aggregation Problems II
Part 5 - Minimal Stats Aggregation
Part 6a - COPY_TABLE_STATS - Intro
Part 6b - COPY_TABLE_STATS - Mistakes
Part 6c - COPY_TABLE_STATS - Bugs and Patches
Part 6d - COPY_TABLE_STATS - A Light-bulb Moment
Part 6e - COPY_TABLE_STATS - Bug 10268597

A couple of posts about Incremental Stats confusion

Part 1
Part 2

Comments

personal blog about Moving Sideways
Wed, 01.06.2016 17:34
That is a good tip particularl y to those fresh to the blogos phere. Short [...]
odziezprestige.pl about Moving Sideways
Wed, 01.06.2016 16:07
Please let me know if you're l ooking for a article writer fo r your site. [...]
Doug Burns about Moving Sideways
Tue, 10.05.2016 21:43
Oh, I won't give it that long unless I enjoy it ;-)

Bookmark

Open All | Close All

Syndicate This Blog

  • XML RSS 2.0 feed
  • ATOM/XML ATOM 1.0 feed
  • XML RSS 2.0 Comments
  • Feedburner Feed

Powered by

Serendipity PHP Weblog

Show tagged entries

xml 11g
xml ACE
xml adaptive thresholds
xml ASH
xml Audit Vault
xml AWR
xml Blogging
xml conferences
xml Cuddly Toys
xml Database Refresh
xml dbms_stats
xml Direct Path Reads
xml Fun
xml Grid Control
xml hotsos 2010
xml listener
xml locking
xml oow
xml oow2009
xml optimiser
xml OTN
xml Parallel
xml partitions
xml Patching
xml Swingbench
xml The Reality Gap
xml Time Matters
xml ukoug
xml ukoug2009
xml Unix/Shell
xml Useful Links

Disclaimer

For the avoidance of any doubt, all views expressed here are my own and not those of past or current employers, clients, friends, Oracle Corporation, my Mum or, indeed, Flatcat. If you want to sue someone, I suggest you pick on Tigger, but I hope you have a good lawyer. Frankly, I doubt any of the former agree with my views or would want to be associated with them in any way.

Design by Andreas Viklund | Conversion to s9y by Carl