我有一个包含两个字段的表:
id(serial), data(jsonb)
在数据中,我有一个 Datetime 字段的记录,该字段存储为 UNIX 时间戳:
{"Device":132,"Datetime": 1434166552,...}
我正在尝试在范围之间进行查询:
SELECT *
FROM trips
WHERE data->>'Datetime' BETWEEN
EXTRACT(EPOCH FROM date '2014-04-01') AND
EXTRACT(EPOCH FROM date '2014-04-15' + interval '1 day')
AND id = 123
信息
ERROR: operator does not exist: text >= double precision
LINE 3: WHERE data->>'Datetime' BETWEEN
我做错了什么,请云有人帮助我吗?谢谢。