U140: Range lower bound must be less than or equal to range upper bound
SQLSTATE: 22000 (Class 22 - Data Exception: data_exception)
Example Postgres Log Output:
ERROR: range lower bound must be less than or equal to range upper bound CONTEXT: COPY mytable, line 169, column rangecolumn STATEMENT: COPY public.mytable("rangecolumn") FROM STDIN BINARY
Your application specified a Postgres range type value (for example as part of an INSERT or COPY), with an upper bound value that was lower than the lower bound value.
Postgres requires that you specify the bound values the other way around in this case.
For example, the following SQL would produce the error:
ERROR: range lower bound must be less than or equal to range upper bound LINE 1: SELECT '[3,2)'::int4range;
Changing the order resolves the problem:
int4range ----------- [2,3) (1 row)
Investigate the application code that generated the data being passed to Postgres, and possibly sort the range bounds to ensure that the lower bound is indeed lower than the upper bound.
No additional resources available.
Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →