Plans to support "range types"?


#1

Hello. Does MemSQL have any plans to develop a “range type”? For example, postgresql has a range type even if the syntax is a bit obtuse.

As far as I can tell in order to support range functionality something like the following would have to be done:

CREATE TABLE t (
  min_value INT,
  max_value INT
);

INSERT INTO t (min_value, max_value)
VALUES (20, 30);

SELECT * FROM t
WHERE 23 >= t.min_value AND 23 < t.max_value;

It would be really nice to have something like as follows:

CREATE TABLE t (
  value INT_RANGE
);

INSERT INTO t (value)
VALUES ('[20, 30)');

SELECT * FROM t
WHERE 23 IN t.value

#2

We’re not planning to add this at the current time. You could approximate it with a package of user-defined functions. E.g. create a JSON or string column to hold two values and the boundaries. Then make functions to operate on it, e.g.

SELECT * FROM t
WHERE rg_contains(t.value, 23);

#3

What does your app do?