From fe83763c365dfa2ba77ebd902810683cedd58ffa Mon Sep 17 00:00:00 2001 From: Geir Nøklebye Date: Thu, 13 Apr 2017 12:07:06 +0200 Subject: PGSQL: Fixed a failing query in GroupsData for deleting groups messages older than 14 days. The little known abstime function could be used for a double cast. The field TMStamp should be changed to store the data as a proper timestamp. Related to Mantis #7848. Usually this would easily be solved using the to_timestamp function, but there is no support for it in NPGSQL as there are no very close functionality in .NET Signed-off-by: Michael Cerquoni --- OpenSim/Data/PGSQL/PGSQLGroupsData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs index 6ef576b..f398256 100755 --- a/OpenSim/Data/PGSQL/PGSQLGroupsData.cs +++ b/OpenSim/Data/PGSQL/PGSQLGroupsData.cs @@ -435,7 +435,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand()) { - cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); + cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm); ExecuteNonQuery(cmd); } @@ -461,7 +461,7 @@ namespace OpenSim.Data.PGSQL using (NpgsqlCommand cmd = new NpgsqlCommand()) { - cmd.CommandText = String.Format("delete from {0} where \"TMStamp\" < CURRENT_DATE - INTERVAL '2 week'", m_Realm); + cmd.CommandText = String.Format("delete from {0} where \"TMStamp\"::abstime::timestamp < now() - INTERVAL '2 week'", m_Realm); ExecuteNonQuery(cmd); } -- cgit v1.1