CREATE TABLE orders (
id SERIAL PRIMARY KEY,
total_price NUMERIC,
discount_price NUMERIC
);
INSERT INTO orders (total_price, discount_price) VALUES
(120, 80), -- 100 is between these (SYMMETRIC: yes)
(150, 200), -- 100 is NOT between these
(90, 110), -- 100 is between these
(50, 50), -- 100 is NOT between
(130, 70); -- 100 is between these (SYMMETRIC: yes)
SELECT *
FROM orders
WHERE 100 BETWEEN SYMMETRIC total_price AND discount_price;
Relevant PG docs: https://www.postgresql.org/docs/current/functions-comparison.html
Steps to reproduce:
The parsing error: