Closed lanfangping closed 2 years ago
This should be fixed in commit ba2eaedfd214ffed36a34bea1438574e141601f9. The issue was that operators for comparison between int type and int4_faure type were not defined. Now, they are defined and we don't need a single quote around integers even if they are being compared against int4_faure datatype. Closing issue for now. Please let me know if the problem persists
Problem description
I found the parser of datalog/faure-log has an incorrect representation for integer operand(i.e., y = 1). The generated SQL for rule
R(x,z) :- R(x,y)[y = 1],l(y,z)
isI think
t0.c1 = 1
in the where clause should bet0.c1 = '1'
because the datatype oft0.c1
is int4_faure. It does not report an error but I think it is a bug in the parser. I tried to use!=
operator for the int4_faure column (e.g.,t0.c1 != 1
) in the condition and the generated SQL run in Postgres that reported "operator does not exist for int4_faure and integer" because the integer operand was not surrounded by single quotes.In addition, the generated SQL for rule
R(e1,h3,[a3, x],2) :- R(a3,h3,[x],1),l(a3,e1)
isThe
t0.c3 = '1'
should bet0.c3 = 1
becauset0.c3
is integer column. It's not a big problem but I think fixing it would be better.I also found an interesting thing. Assume
c2
is an int4_faure type of column. If the constraint in the SQL where clause isc2 = 1
(should bec2 = '1'
), the SQL runs correctly. But if uses other operators, such asc2 < 1
, the SQL runs an error.Test Case
Use case in
unit_tests.py
.