Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Jul 28, 2025

Based on top of #36442, review last commit only.

Note: disabling this specifically when UseAzureSql() is used, as RETURNING isn't supported there yet (but should be supported very soon).

Closes #35729

@roji roji force-pushed the SqlServerJsonValueReturning branch from 4997eeb to 6b62059 Compare July 29, 2025 13:08
@roji roji marked this pull request as ready for review July 29, 2025 15:52
@roji roji requested a review from a team as a code owner July 29, 2025 15:52
SqlServerEngineType.SqlServer when SqlServerCompatibilityLevel >= 170 => true,
SqlServerEngineType.AzureSql when AzureSqlCompatibilityLevel >= 170 => true,
SqlServerEngineType.AzureSynapse => false,
_ => false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't UnreachableException make more sense here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that there's an Unknown value in the SqlServerEngineType enum - any idea in what situation we can get it or what it means?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Unknown will never pass through the validation, so it can be ignored here. It's there purely for ConfigureSqlEngine.

Copy link
Member Author

@roji roji Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks - I'll switch to UnreachableException then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it reachable when the compatibility level is below 170?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah of course :/ Thanks @stevendarby

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this to throw UnreachableException when an unknown enum label is encountered, but not otherwise.

Copy link
Member Author

@roji roji Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cincuranet the tests failed for me because... in SqlServerSingletonOptions the Engine is Unknown. I'm changing the code to return false for Unknown for now so as to not block on this, but this is something we should fix (opened #36477 to track).

@roji roji force-pushed the SqlServerJsonValueReturning branch from 6b62059 to 9437369 Compare July 31, 2025 06:29
@roji roji requested a review from cincuranet July 31, 2025 06:31
@roji
Copy link
Member Author

roji commented Jul 31, 2025

@cincuranet @stevendarby rebased on latest main and did a couple fixes, should be ready for another review and merge.

@roji roji enabled auto-merge (squash) July 31, 2025 06:31
@roji
Copy link
Member Author

roji commented Jul 31, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@roji roji merged commit 91d41df into dotnet:main Jul 31, 2025
7 checks passed
@roji roji deleted the SqlServerJsonValueReturning branch July 31, 2025 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support the new RETURNING clause in JSON_VALUE() in the upcoming SQL Server 2025

3 participants