Sql_log against postgresql

Phil Mayers p.mayers at imperial.ac.uk
Sun Feb 3 15:02:24 CET 2008


Roy Walker wrote:
> Have 2.0 running against a Postgresql database.  The sql_log code looks 
> like it functions differently than the sql statements in the postgres 
> driver (stop packets are another insert instead of an update).  Has 
> anyone already changed out the sql lines match the way it works without 
> sql_log, don’t see why it would be an issue…  if you have would you mind 

It is more complicated than that. The sql module does this:

  do query
  if rows==0:
    do query_alt

The "query" and "query_alt" are normally an update and insert, 
respectively; this helps the SQL module handle missed accounting packets.

The radsqlrelay perl script does not support that mode of operation. 
It's a single query per-packet.

> sharing it?

I used postgres stored procedures. The code is too long and 
site-specific to be useful, so little point in me sharing it. It 
basically does

  * all "sql_log" queries are "insert into radacct_packet ()"
  * stored proc is a trigger on radacct_packet table
  * stored proc does the update/insert logic into main "radacct" table

The other option is to just use the new-in-2.0 "listen" "type = detail" 
function and the "real" sql module; see:

  raddb/sites-available/buffered-sql

> 
>  
> 
> PS  Nice to see the column names were corrected in 2.0 (between MySql 
> and Postgresql schemas).
> 
>  
> 
> Thanks,
> 
> Roy
> 
> 
> ------------------------------------------------------------------------
> 
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html




More information about the Freeradius-Users mailing list