4 * Postgresql extra schema for FreeRADIUS
6 * Note: (pnixon: 2003-12-10) The following function should not be required
7 * if you use the PG specific queries in raddb/postgresql.conf
9 * Common utility function for date calculations. This is used in our
10 * alternative account stop query to calculate the start of a session.
12 * This function is Copyright 2001 by Mark Steele (msteele@inet-interactif.com)
14 * Please note that this requires the plpgsql to be available in your
15 * radius database. If it is not available you can register it with
16 * postgres by running this command:
18 * createlang plpgsql <databasename>
20 CREATE FUNCTION DATE_SUB(date,int4,text) RETURNS DATE AS '
25 var2 = $2 || '' '' || $3;
27 to_date($1 - var2::interval, ''YYYY-MM-DD'');
29 END;' LANGUAGE 'plpgsql';