Azure / azure-functions-sql-extension

Azure SQL bindings for Azure Functions ⚡️ supports Azure SQL Database, Azure SQL Managed Instance, and SQL Server 2016+
https://aka.ms/sqlbindings
MIT License
123 stars 62 forks source link

SqlTrigger not working in with Azure SQL Database collated Finnish_Swedish_CI_AI #1036

Open jakehatinen opened 9 months ago

jakehatinen commented 9 months ago

Steps to Reproduce:

  1. Azure SQL Database with collation Finnish_Swedish_CI_AI
  2. Create table with above collation with some nvarchar and varchar columns
  3. Turn on database server change tracking
  4. Turn on table change tracking
  5. Create function with SqlTrigger to above table
  6. Run function
  7. Function failes with error: Failed to check for changes in table 'Tablename' due to exception: Microsoft.Data.SqlClient.SqlException. Exception message: Cannot resolve the collation conflict between "Finnish_Swedish_CI_AI" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
github-actions[bot] commented 8 months ago

We need more info to debug your particular issue. If you could attach your logs to the issue, it would help us fix the issue much faster. Note that these instructions are for local development only.

  1. Set the default logging level to Debug and enable logging to a file. To do this ensure the following entries are in your host.json. (instructions)
{
  "logging": {
    "fileLoggingMode": "always",
    "logLevel": {
      "default": "Debug"
    }
  }
}
  1. Restart your function and reproduce your issue

  2. Get the log file and attach it to this issue. By default this will be in %TMP%/LogFiles/Application/Functions/Host.

NOTE Debug logging will include information such as Database and table names, if you do not wish to include this information you can either redact it from the logs before attaching or let us know and we will provide a way to send logs directly to us.

MaddyDev commented 8 months ago

@jakehatinen I couldn't repro the issue on my local function on SQL 16 version. Going to try installing the specified version and try to see if I can repro the issue, meanwhile can you share logs.

jakehatinen commented 8 months ago

Hi, thanks for the reply.

Logs attached. Tested with table created with following:

create table TestTable ( First nvarchar(1000) collate SQL_Latin1_General_CP1_CI_AS, Second nvarchar(20) collate SQL_Latin1_General_CP1_CI_AS, Partition nvarchar(20) collate Finnish_Swedish_CI_AI, constraint PK_VendVendorPostalAddressStaging primary key (Partition, Second) )

In Azure Database db collated Finnish_Swedish_CI_AI 2024-02-27T06-38-09Z-i9.log