Fix OPENJSON compatibility for SQL Server 2008 and low compatibility …#120
Conversation
|
|
|
The CI failure appears to be unrelated to this PR — it's failing on dotnet restore due to the AppVeyor environment not having the .NET 10 SDK installed. The same failure would occur on any PR against current master. |
|
Hi! Just a heads-up regarding my PR — the CLA Assistant bot is showing "Contributor License Agreement is not signed yet", but I have already signed the CLA. It seems like the bot isn't picking up my signature automatically. I wanted to let you know so you're not blocked waiting on that status to clear. If there's anything on your end that can help trigger a re-check, or if you need me to take any additional steps, just let me know! Thanks for your time and for maintaining this project 🙌 |
Problem
CompleteMessagesusedOPENJSONto update outbox messages as sent, which requires SQL Server 2016 or higher and a database compatibility level of 130 or above. This caused failures on SQL Server 2008 and on newer SQL Server versions with a lower compatibility level configured.Additionally,
GetOutboxMessageshad a missingANDkeyword in theWHEREclause when filtering bycorrelationId, causing a SQL syntax error when correlation ID filtering was used.Changes
DetectOpenJsonSupportAsyncinInitialize()that checkscompatibility_levelfromsys.databasesto determine ifOPENJSONis availableCompleteMessagesnow falls back to an equivalent XML-based approach whenOPENJSONis not supportedANDinGetOutboxMessageswhen filtering bycorrelationIdNotes
The XML fallback produces identical results to the
OPENJSONapproach. The compatibility check usessys.databasesas recommended by Microsoft's own documentation forOPENJSON.Closes #119