Skip to content

Commit 9a0aaab

Browse files
authored
feat(optimizer)!: Annotate SOUNDEX(expr) for TSQL (#6887)
1 parent 9c39f08 commit 9a0aaab

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

sqlglot/typing/tsql.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
},
2121
exp.CurrentTimezone: {"returns": exp.DataType.Type.NVARCHAR},
2222
exp.Radians: {"annotator": lambda self, e: self._annotate_by_args(e, "this")},
23+
exp.Soundex: {"returns": exp.DataType.Type.VARCHAR},
2324
}

tests/fixtures/optimizer/annotate_functions.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5552,6 +5552,10 @@ FLOAT;
55525552
CURRENT_TIMEZONE();
55535553
NVARCHAR;
55545554

5555+
# dialect: tsql
5556+
SOUNDEX(tbl.str_col);
5557+
VARCHAR;
5558+
55555559
--------------------------------------
55565560
-- MySQL
55575561
--------------------------------------

0 commit comments

Comments
 (0)