]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Handle case where Acct-Session-Time might not exist
authorAlan T. DeKok <aland@freeradius.org>
Tue, 8 Dec 2009 13:00:53 +0000 (14:00 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 8 Dec 2009 13:01:18 +0000 (14:01 +0100)
raddb/sql/postgresql/dialup.conf

index 144d7f8c5d2f7271b21c318909334251a66eefe1..7feef84807420020d4aedd8d0b36fcb9ac45f953 100644 (file)
@@ -226,7 +226,8 @@ accounting_stop_query = "UPDATE ${acct_table2} \
   SET AcctStopTime = ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), \
   AcctSessionTime = CASE WHEN '%{Acct-Session-Time}' = '' THEN \
   (EXTRACT(EPOCH FROM ('%S'::TIMESTAMP WITH TIME ZONE - AcctStartTime::TIMESTAMP WITH TIME ZONE \
-  - '%{%{Acct-Delay-Time}:-0}'::INTERVAL)))::BIGINT ELSE '%{Acct-Session-Time}' END, \
+  - '%{%{Acct-Delay-Time}:-0}'::INTERVAL)))::BIGINT \
+  ELSE NULLIF('%{Acct-Session-Time}','')::BIGINT END, \
   AcctInputOctets = (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint), \
   AcctOutputOctets = (('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Output-Octets}:-0}'::bigint), \
   AcctTerminateCause = '%{Acct-Terminate-Cause}', \