BugZero found this defect 459 days ago.
Data sources
All data on this page is proprietary to BugZero® or gathered from public sources
2/16/2023
SQL Server 2019 on Linux
SQL Server 2019 on Windows
build lower than 15.0.4298.1
15.0.4298.1
When the SQL plan has interleaved execution enabled and uses the OPTION (OPTIMIZE FOR) clause, the table-valued function (TVF) that uses a parameter passed in the same SQL statement gives incorrect results on the first run.
This problem is fixed in the following cumulative update for SQL Server: Cumulative Update 19 for SQL Server 2019 Note Here is an example of not using interleaved execution after you install this cumulative update: DECLARE @start smalldatetime SELECT count(*) FROM dbo.GetData(@start) OPTION (OPTIMIZE FOR (@start = '2022-05-23T06:00:00')) CREATE FUNCTION [dbo].[GetData] ( @start datetime ) RETURNS TABLE AS RETURN SELECT t.id FROM dbo.TestTable t WHERE t.testdate >= @start GO CREATE TABLE [dbo].[TestTable]( [id] [int] IDENTITY(1,1) NOT NULL, [testdate] [datetime] NULL ) ON [PRIMARY] GO About cumulative updates for SQL Server Each new cumulative update for SQL Server contains all the hotfixes and security fixes that were in the previous build. We recommend that you install the latest build for your version of SQL Server: Latest cumulative update for SQL Server 2019
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Learn about the terminology that Microsoft uses to describe software updates.