@@ -2999,6 +2999,28 @@ SELECT width_bucket('Infinity'::numeric, 1, 10, 0)
29992999statement error pgcode 2201G pq: count must be greater than zero
30003000SELECT width_bucket('-Infinity'::numeric, 1, 10, -1)
30013001
3002+ # Match PostgreSQL's "lower bound cannot equal upper bound" rejection
3003+ # for both overloads, across operand positions (above, below, at the
3004+ # degenerate point). Without the guard, the helper divides by zero
3005+ # and casts +/-Inf or NaN to int, producing INT64_MAX, INT64_MIN, or 0.
3006+ statement error pgcode 2201G pq: lower bound cannot equal upper bound
3007+ SELECT width_bucket(7::numeric, 5::numeric, 5::numeric, 10::int)
3008+
3009+ statement error pgcode 2201G pq: lower bound cannot equal upper bound
3010+ SELECT width_bucket(3::numeric, 5::numeric, 5::numeric, 10::int)
3011+
3012+ statement error pgcode 2201G pq: lower bound cannot equal upper bound
3013+ SELECT width_bucket(5::numeric, 5::numeric, 5::numeric, 10::int)
3014+
3015+ statement error pgcode 2201G pq: lower bound cannot equal upper bound
3016+ SELECT width_bucket(7, 5, 5, 10)
3017+
3018+ statement error pgcode 2201G pq: lower bound cannot equal upper bound
3019+ SELECT width_bucket(3, 5, 5, 10)
3020+
3021+ statement error pgcode 2201G pq: lower bound cannot equal upper bound
3022+ SELECT width_bucket(5, 5, 5, 10)
3023+
30023024
30033025# Sanity check pg_type_is_visible.
30043026query BBB
0 commit comments