JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.05k stars 676 forks source link

fix: EXPOSED-302 Count with alias fails if table name includes schema #2008

Closed bog-walk closed 4 months ago

bog-walk commented 4 months ago

Attempting to use count() in a query that requires an alias (for example, with DISTINCT, GROUP BY, or LIMIT clauses) throws a syntax exception if the table name includes the schema name.

This occurs because the alias name created in count() concatenates the full table name with a dot character.

The alias now uses the table name without a schema prefix and sanitized of quotations, if present.