Skip to content

Commit 90a3fa9

Browse files
authored
feat: mark IgnoreNulls and RespectNulls as unsupported on postgres and mysql (#6377)
Fixes #6376
1 parent 2169f5b commit 90a3fa9

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

sqlglot/dialects/mysql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,11 @@ def attimezone_sql(self, expression: exp.AtTimeZone) -> str:
13291329

13301330
def isascii_sql(self, expression: exp.IsAscii) -> str:
13311331
return f"REGEXP_LIKE({self.sql(expression.this)}, '^[[:ascii:]]*$')"
1332+
1333+
def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
1334+
# https://dev.mysql.com/doc/refman/8.4/en/window-function-descriptions.html
1335+
self.unsupported("MySQL does not support IGNORE NULLS.")
1336+
return self.sql(expression.this)
13321337

13331338
@unsupported_args("this")
13341339
def currentschema_sql(self, expression: exp.CurrentSchema) -> str:

sqlglot/dialects/postgres.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,16 @@ def computedcolumnconstraint_sql(self, expression: exp.ComputedColumnConstraint)
837837

838838
def isascii_sql(self, expression: exp.IsAscii) -> str:
839839
return f"({self.sql(expression.this)} ~ '^[[:ascii:]]*$')"
840+
841+
def ignorenulls_sql(self, expression: exp.IgnoreNulls) -> str:
842+
# https://www.postgresql.org/docs/current/functions-window.html
843+
self.unsupported("PostgreSQL does not support IGNORE NULLS.")
844+
return self.sql(expression.this)
845+
846+
def respectnulls_sql(self, expression: exp.RespectNulls) -> str:
847+
# https://www.postgresql.org/docs/current/functions-window.html
848+
self.unsupported("PostgreSQL does not support explicit RESPECT NULLS. Just use the expression directly.")
849+
return self.sql(expression.this)
840850

841851
@unsupported_args("this")
842852
def currentschema_sql(self, expression: exp.CurrentSchema) -> str:

0 commit comments

Comments
 (0)