You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When access to condition column passes through several tables, for the joined tables generated a very long alias.
And I get FirebirdSql.Data.FirebirdClient.FbException: "Dynamic SQL Error Name longer than database column size"
Example
class Table1
{
int id
int value
int idTable2
[ForeignKey("idTable2")]
Table2 table2
}
class Table2
{
int id
int idTable3
[ForeignKey("idTable3")]
Table3 table3
}
class Table3
{
int id
bool condition
}
When i do:
var result = Table1.where(t => t.table2.table3.condition).select(t => value)
generates query:
SELECT
"t"." value"
FROM
Table1 AS "t"
LEFT JOIN Table2 AS "t.Table2" ON "t"."idTable2" = "t.Table2"."id"
LEFT JOIN Table3 AS "t.Table2.Table3" ON "t.Table2"."IdTable3" = "t.Table2.Table3"."id"
WHERE
"t.Table2.Table3"."condition"
The O/R framework MDriven solves this by adding a three letter hash of the superfluous characters when a generated identifier is longer than the allowed length. I.e. when max length is 31 characters, any identifier longer than 31 characters is truncated after 28 characters and the truncated part is replaced with a three letter hash. It also makes sure all identifiers are unique (not sure how that's done).
This is something that needs deeper investigation. The aliases are, sadly, what EFCore expects by default in the reader. It might be possible to change this, but haven't had time to look at it yet.
Submitted by: Pavel (pavelr)
When access to condition column passes through several tables, for the joined tables generated a very long alias.
And I get FirebirdSql.Data.FirebirdClient.FbException: "Dynamic SQL Error Name longer than database column size"
Example
class Table1
{
int id
int value
int idTable2
[ForeignKey("idTable2")]
Table2 table2
}
class Table2
{
int id
int idTable3
[ForeignKey("idTable3")]
Table3 table3
}
class Table3
{
int id
bool condition
}
When i do:
var result = Table1.where(t => t.table2.table3.condition).select(t => value)
generates query:
SELECT
"t"." value"
FROM
Table1 AS "t"
LEFT JOIN Table2 AS "t.Table2" ON "t"."idTable2" = "t.Table2"."id"
LEFT JOIN Table3 AS "t.Table2.Table3" ON "t.Table2"."IdTable3" = "t.Table2.Table3"."id"
WHERE
"t.Table2.Table3"."condition"
Commits: 9cadc9a
The text was updated successfully, but these errors were encountered: