xtdb

esp1 2024-10-31T20:15:34.458539Z

There seem to be some inconsistencies in the temporal filters for SQL and XTQL. SQL has these https://docs.xtdb.com/reference/main/sql/queries.html#_temporal_filter: • AS OF FROM TO BETWEEN AND Some notes/questions: • Is FROM/TO equivalent to BETWEEN/AND? XTQL has these https://docs.xtdb.com/reference/main/xtql/queries.html#_from: • at ◦ the documentation for this refers to two timestamps (`row-from <= timestamp < row-to`), but this filter only takes one, so I think this documentation is wrong • from to in SQL AS OF is equivalent to XTQL at, and SQL FROM/TO and BETWEEN/AND seem equivalent to XTQL in, but there does not seem to be any SQL equivalent to the XTQL from and to temporal filters.

jarohen 2024-10-31T20:44:37.679589Z

Hey @esp1 🙂 > Is FROM/TO equivalent to BETWEEN/AND? not quite - from/to is inclusive/exclusive, between/and is inclusive/inclusive > the documentation for this refers to two timestamps (`row-from <= timestamp < row-to`), but this filter only takes one, so I think this documentation is wrong timestamp is the one in the filter; row-from and row-to apply to the documents in your table - so either valid-from and valid-to or system-from and system-to, depending on whether it's a VT or ST filter > there does not seem to be any SQL equivalent to the XTQL from and to temporal filters from and to, used alone, really just create open-ended ranges, so they're equivalent to (in nil) and (in nil ) respectively. There's no SQL equivalent for this, although IIRC we do accept NULL in FROM TO HTH 🙂

esp1 2024-10-31T20:47:21.456389Z

that does help, thanks!

esp1 2024-10-31T21:24:48.880729Z

Hm, I think I found another bug. The XTQL to temporal filter does not appear to work...

jarohen 2024-10-31T21:30:50.284569Z

tbh we really need to give XTQL some love, it's not been a focus for the last 12m or so while we've been building out the SQL/Postgres tooling support and more generally focusing on performance and execution stability 😕

➕ 1