4 * OPTIONAL Postgresql trigger for FreeRADIUS
6 * This trigger updates fills in the groupname field (which doesnt come in Accounting packets)
7 * by querying the radusergroup table.
8 * This makes it easier to do group summary reports, however note that it does add some extra
9 * database load to 50% of your SQL accounting queries. If you dont care about group summary
10 * reports then you dont need to install this.
15 CREATE OR REPLACE FUNCTION upd_radgroups() RETURNS trigger AS'
21 SELECT INTO v_groupname groupname FROM radusergroup WHERE calledstationid = NEW.calledstationid AND username = NEW.username;
23 UPDATE radacct SET groupname = v_groupname WHERE radacctid = NEW.radacctid;
32 DROP TRIGGER upd_radgroups ON radacct;
34 CREATE TRIGGER upd_radgroups AFTER INSERT ON radacct
35 FOR EACH ROW EXECUTE PROCEDURE upd_radgroups();