You are currently offline, waiting for your internet to reconnect

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

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)
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.
Do not use ORDER BY..DESC on all the columns that are a part of the primary key.
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.
To reproduce this problem, create the table using the following script:
Create table TestTable ( x int, y int primary key(x,y))goinsert 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 connectionSet Transaction Isolation level serializablegobegin tranSELECT * FROM TestTable WHERE Document=1 ORDER BY x DESC,y DESC ---In the other connection run the insert, this should be blockedinsert into TestTable values(1,2)				

Article ID: 243502 - Last Review: 10/22/2013 01:24:35 - Revision: 2.1

Microsoft SQL Server 7.0 Standard Edition

  • kbnosurvey kbarchive kbbug kbfix KB243502