Comparing times to "now + 45 seconds"
От | Rikard Bosnjakovic |
---|---|
Тема | Comparing times to "now + 45 seconds" |
Дата | |
Msg-id | d9e88eaf1001240208u2e73a149j1087baf3d5a417d8@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Comparing times to "now + 45 seconds"
Re: Comparing times to "now + 45 seconds" |
Список | pgsql-novice |
I have this table: # select * from live_stats; times ---------- 17:30:00 18:30:00 20:11:00 10:11:00 (4 rows) I want to compare these times to the actual (current) time + 45 seconds. If the current time + 45 seconds is higher than the time in the table, I want "true". First, I tried this: # select times, times > now()::time AS time_compare from live_stats; times | time_compare ----------+-------------- 17:30:00 | t 18:30:00 | t 20:11:00 | t 10:11:00 | f (4 rows) Which works, but I don't know how to apply the "45 seconds": # select times, times > (now()::time + '45 seconds') AS time_compare from live_stats; ERROR: operator is not unique: time without time zone + unknown LINE 1: select times, times > (now()::time + '45 seconds') AS time_c... ^ HINT: Could not choose a best candidate operator. You might need to add explicit type casts. # select times, times > (now()::time + '00:00:45') AS time_compare from live_stats; ERROR: operator is not unique: time without time zone + unknown LINE 1: select times, times > (now()::time + '00:00:45') AS time_com... ^ HINT: Could not choose a best candidate operator. You might need to add explicit type casts. # select times, times > (now()::time + '00:00:45'::time) AS time_compare from live_stats; ERROR: operator is not unique: time without time zone + time without time zone LINE 1: select times, times > (now()::time + '00:00:45'::time) AS ti... ^ HINT: Could not choose a best candidate operator. You might need to add explicit type casts. How am I supposed to do this comparison? What I'm doing is that I have an application that queries the time and if 45 seconds have passed, then it's supposed to update the table (to reduce server load). -- - Rikard - http://bos.hack.org/cv/
В списке pgsql-novice по дате отправления: