Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No-op if engineedition is 6 or 11 due to lack of support for ASSEMBLYPROPERTY function #2593

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
Expand All @@ -17,7 +18,7 @@ internal sealed class SqlMetaDataFactory : DbMetaDataFactory

private const string ServerVersionNormalized90 = "09.00.0000";
private const string ServerVersionNormalized10 = "10.00.0000";

private readonly HashSet<int> _assemblyPropertyUnsupportedEngines = new() { 6, 9, 11 };

public SqlMetaDataFactory(Stream XMLStream,
string serverVersion,
Expand Down Expand Up @@ -51,11 +52,13 @@ private void addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection con

SqlCommand engineEditionCommand = connection.CreateCommand();
engineEditionCommand.CommandText = "SELECT SERVERPROPERTY('EngineEdition');";
var engineEdition = (int)engineEditionCommand.ExecuteScalar()!;
var engineEdition = (int)engineEditionCommand.ExecuteScalar();

if (engineEdition == 9)
if (_assemblyPropertyUnsupportedEngines.Contains(engineEdition))
{
// Azure SQL Edge throws an exception when querying sys.assemblies
// Azure SQL Edge (9) throws an exception when querying sys.assemblies
// Azure Synapse Analytics (6) and Azure Synapse serverless SQL pool (11)
// do not support ASSEMBLYPROPERTY
return;
}

Expand Down
Loading