Microsoft KB Archive/243502

From BetaArchive Wiki
Knowledge Base


FIX: SERIALIZABLE Isolation Allows Phantom Inserts with SELECT...ORDER BY DESC

Article ID: 243502

Article Last Modified on 3/14/2006



APPLIES TO

  • Microsoft SQL Server 7.0 Standard Edition



This article was previously published under Q243502

BUG #: 56052 (SQLBUG_70)

SYMPTOMS

When using SERIALIZABLE transactions isolation level, inserts on a table that has a compound clustered index defined are allowed while a SELECT is currently being run against that table with an ORDER BY..DESC clause that includes all columns of the clustered index.

The Isolation level SERIALIZABLE should lock the data set, preventing other users from updating or inserting rows into the data set until the transaction is complete. However, when the preceding stated conditions are true, phantoms are allowed.

WORKAROUND

Do not use ORDER BY..DESC on all the columns that are a part of the primary key.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0


For more information, contact your primary support provider.

MORE INFORMATION

To reproduce this problem, create the table using the following script:

Create table TestTable 
( x int, y int primary key(x,y))
go

insert into TestTable values(1,1)
insert into TestTable values(2,1)
                

Then, open two Query Analyzer connections and run the following scripts:

----Run these commands in the first connection

Set Transaction Isolation level serializable
go

begin tran
SELECT * FROM TestTable WHERE Document=1 ORDER BY x DESC,y DESC 

---In the other connection run the insert, this should be blocked

insert into TestTable values(1,2)
                

Keywords: kbbug kbfix KB243502