PostgreSQL类型转换问题

时间:2011-07-12 16:51:24

标签: postgresql casting types

我导入了PostgreSQL数据库并且我一直收到此错误:

  

错误:运算符不存在:date> =整数LINE 1:... tut.id_pf   AND clearlya_info_statut.data_sch_statut> = 2010-07 -... ^提示:否   运算符匹配给定的名称和参数类型。你可能需要   添加显式类型转换。

我的查询如下:

  

SELECT p_fiz.nr_certif,p_fiz.nume,p_fiz.prenume,localizari.id_jud,obviousa_info_statut.data_sch_statut,obviousa_info_statut.statut,rapoarte_anuale.data_depunere,rapoarte_anuale.angajamente,obviousa_asigurari.data_end,lista_statute.descriere,localizari.id_jud,p_fiz。 nume,p_fiz.prenume,p_fiz.nr_certif,p_fiz.id_pf,p_fiz.nume,p_fiz.prenume,p_fiz.codificare from p_fiz INNER JOIN localizari USING(id_loc)INNER JOIN obviousa_contacte USING(id_contact)LEFT JOIN lista_statute USING(id_statut_existenta)LEFT JOIN clearlya_info_statut ON p_fiz.id_pf = obviousa_info_statut.id_pf AND clearlya_info_statut.data_sch_statut> = 2010-07-12 LEFT JOIN rapoarte_anuale ON p_fiz.id_pf = rapoarte_anuale.id_pf AND rapoarte_anuale.an> 2010 LEFT JOIN obviousa_asigurari ON p_fiz.id_pf = obviousa_asigurari.id_pf AND obviousa_asigurari.data_start> = 2010-07-12 ORDER BY localizari.id_jud ASC,p_fiz.nume ASC,p_fiz.prenume ASC,p_fiz.nr_certif ASC;

据我了解,那是> =或>引起恐怖。

任何想法如何解决这个问题?

P.S。我在Fedora上运行PostgreSQL 8.4。

2 个答案:

答案 0 :(得分:2)

您需要引用日期。

evidenta_info_statut.data_sch_statut >= '2010-07-12'
evidenta_asigurari.data_start >= '2010-07-12'

没有引号,实际上它们被视为整数数学; 2010 - 7 - 12 = 1991

答案 1 :(得分:0)

将日期换成引号

'2010-07-12'