var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Weird behavior with casts to datetime in where clause
Probably, I've misunderstood something but I can't explain this behavior. While the following SQL statement works (and returns 4 rows):
the following returns an empty result (while I would expect at least 4 but normally more):
SELECT * FROM pr_sqlstats WHERE when = '10:24'::datetime HOUR TO MINUTE;
This code is being executed on a table which has been created as follows:
SELECT * FROM pr_sqlstats WHERE when = '10'::datetime HOUR TO HOUR;
Thanks for anybody who can point me to the right direction.
CREATE TABLE pr_sqlstats (
when DATETIME YEAR TO MINUTE DEFAULT CURRENT YEAR TO MINUTE,
who CHAR(8) DEFAULT USER,
... WHERE when = '10'::datetime HOUR TO HOUR; ...
What this is actually doing is casting "10" to 10:00 effectively.
What you actually want is something of the order of...
where hour(when) = 10