Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long aliases are generated in WHERE clause [DNET877] #807

Closed
firebird-automations opened this issue Apr 14, 2019 · 4 comments
Closed

Long aliases are generated in WHERE clause [DNET877] #807

firebird-automations opened this issue Apr 14, 2019 · 4 comments

Comments

@firebird-automations
Copy link

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

@firebird-automations
Copy link
Author

Commented by: Kjell Rilbe (kjellrilbe)

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).

@firebird-automations
Copy link
Author

Commented by: @cincuranet

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.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 6.7.0.0 [ 10900 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants