From: Kurt Roeckx <kurt@roeckx.be>
Date: Wed, 24 Mar 2010 23:06:00 +0000 (+0000)
Subject: No reason to cast it to timestamp anymore, it's now such a field in the db.
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8b5f7ccc75416990c6ac4b5613c8b8821eb23478;p=wannabuild.git

No reason to cast it to timestamp anymore, it's now such a field in the db.
---

diff --git a/bin/wanna-build b/bin/wanna-build
index 8aafba6..bbaf061 100755
--- a/bin/wanna-build
+++ b/bin/wanna-build
@@ -2467,7 +2467,7 @@ sub transactions_table_name {
 sub get_readonly_source_info {
 	my $name = shift;
 	# SELECT FLOOR(EXTRACT('epoch' FROM age(localtimestamp, '2010-01-22  23:45')) / 86400) -- change to that?
-	my $pkg = $dbh->selectrow_hashref('SELECT *, extract(days from date_trunc(\'days\', now() - state_change::timestamp)) as state_days FROM ' . 
+	my $pkg = $dbh->selectrow_hashref('SELECT *, extract(days from date_trunc(\'days\', now() - state_change)) as state_days FROM ' . 
 		table_name() . ' WHERE package = ? AND distribution = ?',
 		undef, $name, $distribution);
 	return $pkg;
@@ -2475,7 +2475,7 @@ sub get_readonly_source_info {
 
 sub get_source_info {
 	my $name = shift;
-	my $pkg = $dbh->selectrow_hashref('SELECT *, extract(days from date_trunc(\'days\', now() - state_change::timestamp)) as state_days FROM ' . 
+	my $pkg = $dbh->selectrow_hashref('SELECT *, extract(days from date_trunc(\'days\', now() - state_change)) as state_days FROM ' . 
 		table_name() . ' WHERE package = ? AND distribution = ?' .
 		' FOR UPDATE',
 		undef, $name, $distribution);
@@ -2486,8 +2486,8 @@ sub get_all_source_info {
 	my %options = @_;
 
 	my $q = 'SELECT *, '.
-		'extract(days from date_trunc(\'days\', now() - state_change::timestamp)) as state_days, '.
-		'date_trunc(\'seconds\', now() - state_change::timestamp) as state_time'.
+		'extract(days from date_trunc(\'days\', now() - state_change)) as state_days, '.
+		'date_trunc(\'seconds\', now() - state_change) as state_time'.
 		' FROM ' . table_name()
 		. ' WHERE distribution = ? ';
 	my @args = ($distribution);
@@ -2510,12 +2510,12 @@ sub get_all_source_info {
 	}
 
 	if ($options{list_min_age} > 0) {
-		$q .= ' AND age(state_change::timestamp) > ? ';
+		$q .= ' AND age(state_change) > ? ';
 		push @args, $options{list_min_age} . " days";
 	}
 
 	if ($options{list_min_age} < 0) {
-		$q .= ' AND age(state_change::timestamp) < ? ';
+		$q .= ' AND age(state_change) < ? ';
 		push @args, -$options{list_min_age} . " days";
 	}