In the case if ">=", the translation of tuple comparison is wrong. The correct translation of (a, b) >= (c, d) is a __>__ c OR (a = c AND b > d). However, currently it is a __>=__ c OR (a = c AND b > d).
Consider the following sample program:
from pony import orm as pony
DB_NAME = "test.sqlite"
db = pony.Database()
class Test(db.Entity):
a = pony.Required(int)
b = pony.Required(int)
db.bind(provider="sqlite", filename=DB_NAME, create_db=True)
db.generate_mapping(create_tables=True)
pony.set_sql_debug(True)
with pony.db_session as ses:
_ = pony.get(f for f in Test if (f.a, f.b) >= (1, 2))
with this output:
GET NEW CONNECTION
SWITCH TO AUTOCOMMIT MODE
SELECT "f"."id", "f"."a", "f"."b"
FROM "Test" "f"
WHERE ("f"."a" >= 1 OR "f"."a" = 1 AND "f"."b" >= 2)
LIMIT 2
RELEASE CONNECTION
In the case if ">=", the translation of tuple comparison is wrong. The correct translation of (a, b) >= (c, d) is
a __>__ c OR (a = c AND b > d)
. However, currently it isa __>=__ c OR (a = c AND b > d)
.Consider the following sample program:
with this output: