Skip to content

Commit c716ba5

Browse files
feat(duckdb): Add transpilation support for COLLATION function
1 parent 86cfdb3 commit c716ba5

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

sqlglot-integration-tests

sqlglot/generators/duckdb.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,6 +2962,13 @@ def chr_sql(self, expression: exp.Chr, name: str = "CHR") -> str:
29622962
arg = exp.cast(arg, exp.DType.INT)
29632963
return self.func("CHR", arg)
29642964

2965+
def collation_sql(self, expression: exp.Collation) -> str:
2966+
this = expression.this
2967+
if isinstance(this, exp.Collate) and this.expression.name:
2968+
return self.sql(this.expression)
2969+
self.unsupported("COLLATION function is not supported by DuckDB")
2970+
return self.sql(exp.null())
2971+
29652972
def _validate_regexp_flags(
29662973
self, flags: t.Optional[exp.Expr], supported_flags: str
29672974
) -> t.Optional[str]:

0 commit comments

Comments
 (0)