SQL generated to check existence of a table puts single quotes around the tabel name string literal returned by stringTypeMapping.GenerateSqlLiteral(TableName), which it should not.
Steps to reproduce
We encounter this when trying to execute migration, when an attempt is made to check for the table __EFMigrationsHistory. This is SQL we get:
SELECT COUNT(*)
FROM rdb$relations r
WHERE
COALESCE(r.rdb$system_flag, 0) = 0
AND
rdb$view_blr IS NULL
AND
rdb$relation_name = '_UTF8'__EFMigrationsHistory''
Notice that there are single quotes around the table name itself (from GenerateSqlLiteral(...)) as well as around the _UTF8 refixed complete literal.
Further technical details
EntityFrameworkCore.FirebirdSql version: 2.1.4
Suggested fix
In FbHistoryRepository.cs, this code appears:
return $@"
SELECT COUNT(*)
FROM rdb$relations r
WHERE
COALESCE(r.rdb$system_flag, 0) = 0
AND
rdb$view_blr IS NULL
AND
rdb$relation_name = '{stringTypeMapping.GenerateSqlLiteral(TableName)}'";
It should be changed into:
return $@"
SELECT COUNT(*)
FROM rdb$relations r
WHERE
COALESCE(r.rdb$system_flag, 0) = 0
AND
rdb$view_blr IS NULL
AND
rdb$relation_name = {stringTypeMapping.GenerateSqlLiteral(TableName)}";
The issue
SQL generated to check existence of a table puts single quotes around the tabel name string literal returned by
stringTypeMapping.GenerateSqlLiteral(TableName)
, which it should not.Steps to reproduce
We encounter this when trying to execute migration, when an attempt is made to check for the table
__EFMigrationsHistory
. This is SQL we get:Notice that there are single quotes around the table name itself (from
GenerateSqlLiteral(...)
) as well as around the_UTF8
refixed complete literal.Further technical details
EntityFrameworkCore.FirebirdSql version: 2.1.4
Suggested fix
In
FbHistoryRepository.cs
, this code appears:It should be changed into: