Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
1124 Представления

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? 



Аватар
Отменить
Лучший ответ

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.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
авг. 25
2832
1
июл. 25
1152
1
авг. 25
1152
0
мая 25
1570
2
апр. 25
3766