Skip to content

v1.1.3

Choose a tag to compare

@eitamring eitamring released this 21 Feb 07:24
· 28 commits to main since this release
9555ce3

Bug Fixes

  • Fix case-sensitive alias resolution in ExtractWhereConditions (#39) —
    WhereCondition.Table now correctly resolves aliases regardless of casing,
    matching PostgreSQL's case-insensitive handling of unquoted identifiers.
    Previously FROM orders o WHERE O.status = 'x' would return Table: "O" instead of
    resolving to "orders".
  • Fix inconsistent CTE/subquery alias resolution in WHERE extraction — CTE and
    subquery aliases now resolve to their declared name consistently. Previously only
    base table aliases were resolved; CTE aliases fell back to the raw token.
  • Fix quoted identifier matching in alias resolution — Alias maps now strip
    double quotes before matching, preventing mismatches between the IR's TableRef
    (quoted) and ColumnUsage (unquoted) fields.

Internal

  • Consolidated duplicate trimQuotes / trimIdentQuotes into shared
    internal/ident.TrimQuotes (#36)
  • ExtractJoinRelationshipsWithSchema now delegates to shared internal
    implementation, removing duplicated join extraction logic
  • Removed redundant resolveTableName wrapper; alias resolution goes through
    resolveAlias directly
  • WHERE and JOIN alias resolution use separate maps (buildWhereAliasMap vs
    buildAliasMap) — WHERE includes all relation types, JOIN stays base-table-only
    for FK inference
  • Added unit tests for alias resolution, quote trimming, join deduplication, and
    DTO conversion

Migration Notes

WhereCondition.Table values are now lowercased for unquoted identifiers (e.g.,
"Orders" → "orders"). This matches PostgreSQL behavior where unquoted identifiers
are folded to lowercase. If you were comparing table names case-sensitively, use
strings.EqualFold instead.