【发布时间】:2015-04-13 00:12:25
【问题描述】:
我有一个这样创建的表:
CREATE TABLE revinfo
(
rev integer NOT NULL,
revtstmp bigint,
CONSTRAINT revinfo_pkey PRIMARY KEY (rev)
)
在这张表里面,我有这样的数据:
rev |revtstmp
40815|1390021342972
40816|1390021401403
40817|1390021409057
40818|1390021409914
40819|1390021411074
40821|1390021463885
40822|1390021467889
40824|1390021469035
40826|1390021470065
40827|1390021472134
...
我想列出 2015 年 2 月 10 日之后所做的所有修订。 我尝试了这个请求:
select rev
from revinfo
where revtstmp > '2015-02-10 00:00:00'::timestamp
我遇到了这个错误:(见下面的翻译)
ERREUR: l'opérateur n'existe pas : bigint > timestamp without time zone
LINE 3: where revtstmp > '2015-02-12 00:00:00'::timestamp
^
HINT: Aucun opérateur ne correspond au nom donné et aux types d'arguments.
Vous devez ajouter des conversions explicites de type.
********** Erreur **********
ERREUR: l'opérateur n'existe pas : bigint > timestamp without time zone
État SQL :42883
Astuce : Aucun opérateur ne correspond au nom donné et aux types d'arguments.
Vous devez ajouter des conversions explicites de type.
Caractère : 47
如何更改我的查询?
翻译(由 Google 翻译提供支持)
ERROR: operator does not exist: bigint> timestamp without time zone
LINE 3: where revtstmp> '2015-02-12 0:00:00' :: timestamp
^
HINT: No operator matches the given name and argument types.
You must add explicit type conversions.
********** ********** Error
ERROR: operator does not exist: bigint> timestamp without time zone
SQL State: 42883
Tip: No operator matches the given name and argument types.
You must add explicit type conversions.
Character: 47
【问题讨论】:
-
revtstmp 不是时间戳,而是一个纪元。使用正常的 ISO 时间戳,您的问题就消失了。
标签: sql postgresql timestamp comparison-operators bigint