Access violation with synonym in CTE - by Erland Sommarskog

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 785518 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 4/24/2013 3:24:39 PM
Access Restriction Public


This scenario is taken from

You have a view, which in a CTE refers to a scalar UDF through a synonym. This results in an Access Violation on SQL 2012. It works on SQL 2008.
Sign in to post a comment.
Posted by Brett Gerhardi(H) on 5/15/2014 at 9:22 AM
Yes please back port it to 2012. The synonym described in the initial case is not required to experience the issue, I have a view with a cte inside and a scalar udf getting called directly from inside the cte and the ownership chain is broken by this.

You can workaround this in some cases by changing the CTE into an good old fashioned table subquery. Not the first time I've had to do this!
Posted by Vidar Nordnes on 10/10/2013 at 3:45 AM
I have two customers that would really appreciate getting this fix for 2012, so please port it to 2012 too
Posted by Microsoft on 6/12/2013 at 11:28 AM
Hello Erland,
We have now fixed the bug for the next major version of SQL Server. We will consider porting it to SQL Server 2012 based on feedback.

Umachandar, SQL Programmability Team
Posted by Microsoft on 5/10/2013 at 10:18 AM
Hello Erland,
Thanks for reporting the bug. We will investigate the problem & let you know what we find.

Umachandar, SQL Programmability Team