RepoDB
RepoDB copied to clipboard
Bug: Wrong SQL is generated when using multiple SQL drivers in an application
Bug Description
Exceptions are thrown when an application tries to use RepoDb for both Postgres and SqlServer.
These particular exceptions are thrown when attempting to insert a row.
I made a repo reproducing it here: https://github.com/asleire/RepoDbMultiDriverBug/blob/master/RepoDbMultiDriverBug/UnitTest1.cs
Running the test OnlyPostgres and OnlySqlServer individually will succeed. Running the test Both always fails. Running all tests causes the first of OnlyPostgres and OnlySqlServer to be executed to pass, and the last to fail.
Exception Message: Using postgres first causes this exception when trying to use SqlServer:
Microsoft.Data.SqlClient.SqlException : Incorrect syntax near 'RETURNING'.
Data:
HelpLink.ProdName: Microsoft SQL Server
HelpLink.ProdVer: 15.00.4102
HelpLink.EvtSrc: MSSQLServer
HelpLink.EvtID: 102
HelpLink.BaseHelpUrl: https://go.microsoft.com/fwlink
HelpLink.LinkId: 20476
Using SqlServer first causes this exception when trying to use Postgres:
Npgsql.PostgresException : 42601: syntax error at or near "["
Data:
Severity: ERROR
InvariantSeverity: ERROR
SqlState: 42601
MessageText: syntax error at or near "["
Position: 13
File: scan.l
Line: 1180
Routine: scanner_yyerror
Library Version: RepoDb.SqlServer 1.1.3 RepoDb.PostgreSql 1.1.3