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 <nebadon2025@gmail.com>
httptests
Geir Nøklebye 2017-04-13 12:07:06 +02:00 committed by Michael Cerquoni
parent 52e03ee5bd
commit fe83763c36
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}