Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
1122 Vizualizări

I am executing the following queries:

SELECT * FROM stock_quant WHERE write_date > '2021-06-19 15:12:11' and the Odoo API also returns records that have write_date = '2021-06-19 15:12:11'

I have executed the following query and SELECT * FROM stock_quant WHERE write_date <= '2021-06-19 15:12:11' and the Odoo API doesn not return records that have write_date'2021-06-19 15:12:11'.


I would expect that for the first query the api will return only records that have write_date greater than '2021-06-19 15:12:11'. And in the second query I expect to get records that have write_date less then or equal to '2021-06-19 15:12:11', but this does not happen.

Could you please let me know why there is such a behaviour? 



Imagine profil
Abandonează
Cel mai bun răspuns

I believe it is because the timestamp in the database includes microseconds but when you look at the record are the value has been trunicated to seconds. So when you see a record with time 15:12:11, in the database it is stored as 15:12:11.222222 (for example) and is therefore greater than 15:12:11

You can confirm this is how the values are stored by connecting to the db from the shell and looking at the values in your write_date field.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
aug. 25
2832
1
iul. 25
1152
1
aug. 25
1152
0
mai 25
1570
2
apr. 25
3766