diff options
author | Matthew Somerville <matthew@cake.ukcod.org.uk> | 2010-05-12 13:40:58 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@cake.ukcod.org.uk> | 2010-05-12 13:40:58 +0100 |
commit | 7c9d76755e99e62c3c43065cae785c02086a9e92 (patch) | |
tree | 71336cab6f73fd5b32f2308ccd9693411171ba2a | |
parent | e42a5835537f9afbc053da7bf24b48d9f9b0d67e (diff) |
Fetch ms_current_timestamp() separately, otherwise psql doesn't use an index, sigh; update commonlib.
m--------- | commonlib | 0 | ||||
-rw-r--r-- | perllib/Problems.pm | 6 |
2 files changed, 4 insertions, 2 deletions
diff --git a/commonlib b/commonlib -Subproject b1db274c894f3ddce98632dc21f1d5649d749d8 +Subproject fdcc1684406365f94cc9beedc9c251343df7693 diff --git a/perllib/Problems.pm b/perllib/Problems.pm index c9caf41f2..69293e162 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -515,9 +515,10 @@ sub timeline_alerts { if ($cobrand) { $cobrand_clause = " and cobrand = '$cobrand'"; } + my $current_time = dbh()->selectrow_array('select ms_current_timestamp()'); my $alerts = select_all("select *, extract(epoch from whensubscribed) as whensubscribed - from alert where whensubscribed>=ms_current_timestamp()-'7 days'::interval + from alert where whensubscribed>='$current_time'-'7 days'::interval and confirmed=1 $cobrand_clause"); return $alerts; @@ -537,10 +538,11 @@ sub timeline_deleted_alerts { $cobrand_clause = " and cobrand = '$cobrand'"; } + my $current_time = dbh()->selectrow_array('select ms_current_timestamp()'); my $alerts = select_all("select *, extract(epoch from whensubscribed) as whensubscribed, extract(epoch from whendisabled) as whendisabled - from alert where whendisabled>=ms_current_timestamp()-'7 days'::interval + from alert where whendisabled>='$current_time'-'7 days'::interval $cobrand_clause"); return $alerts; |