microsoft / microsoft/DacFx

DW - support for table-valued functions missing

Open
#390 2 comments 2 reactions 0 assignees View on GitHub
bug sqldw
Dominant language
C#
Stars
460
Forks
29
Avg merge
4d 9h
Merged PRs (30d)
7

Description

- SqlPackage or DacFx Version: 162.1.167.1
- .NET Framework (Windows-only) or .NET Core:
- Environment (local platform and source/target platforms):

**Steps to Reproduce:**
Create a new database project in ADS that targets synapse azure sql dedicated pool project

1. Create a Table
```
CREATE TABLE [dbo].[DimTest]
(
[Id] INT
)
(
DISTRIBUTION = ROUND_ROBIN,
HEAP
)
```
3. Create and inline TVF that accesses the table:
```
CREATE FUNCTION [dbo].[fnTest] (@Id bigint)
RETURNS TABLE
AS
RETURN (
SELECT Id FROM [dbo].[DimTest]
WHERE Id = @Id
)
```

This will work if you run within SSMS,

However if put in as objects in a database project (SSDT or ADS) it will cause the build error: _Build error SQL71636: You cannot use types or statements that modify the database state._

see here for more context: https://learn.microsoft.com/en-us/answers/questions/419193/azure-data-warehouse-function-has-problem-when-we

**Did this occur in prior versions? If not - which version(s) did it work in?**

(DacFx/SqlPackage/SSMS/Azure Data Studio)

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in a database project using the shown DimTest table and inline table-valued function, then compare the project build with execution in SSMS. Trace the build handling that produces SQL71636; done means the function can reference the table without the build error for the Synapse dedicated pool target.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, sql
Domain
build-system, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.