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

Article translations Article translations
Article ID: 243502 - View products that this article applies to.
This article was previously published under Q243502
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 56052 (SQLBUG_70)
Expand all | Collapse all

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)
				

Properties

Article ID: 243502 - Last Review: October 22, 2013 - Revision: 2.1
APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbbug kbfix KB243502

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com