Skip to content

Commit f654ee8

Browse files
committed
fix(postgres): Fix exp.WidthBucket required args
1 parent d0965ba commit f654ee8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

sqlglot/expressions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8279,7 +8279,7 @@ class Skewness(AggFunc):
82798279

82808280

82818281
class WidthBucket(Func):
8282-
arg_types = {"this": True, "min_value": True, "max_value": True, "num_buckets": True}
8282+
arg_types = {"this": True, "min_value": True, "max_value": False, "num_buckets": False}
82838283

82848284

82858285
class CovarSamp(Binary, AggFunc):

tests/dialects/test_postgres.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ def test_postgres(self):
10151015
"SELECT SLOPE(point '(4,4)', point '(0,0)')",
10161016
"SELECT SLOPE(CAST('(4,4)' AS POINT), CAST('(0,0)' AS POINT))",
10171017
)
1018+
self.validate_identity("SELECT WIDTH_BUCKET(10, ARRAY[5, 15])")
1019+
self.validate_identity("SELECT WIDTH_BUCKET(10, 5, 15, 25)")
10181020

10191021
def test_ddl(self):
10201022
# Checks that user-defined types are parsed into DataType instead of Identifier

0 commit comments

Comments
 (0)