From 8a6348e736f30a37c6ce63667a4430c015b54b37 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 11 Dec 2006 13:19:09 +1300 Subject: [PATCH] Add freebusy support. Remove different Pg8.1 code path which is probably not actually any better than the 7.4 compatible implementation. --- dba/caldav_functions.sql | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/dba/caldav_functions.sql b/dba/caldav_functions.sql index 9c6b6f23..5b8b031c 100644 --- a/dba/caldav_functions.sql +++ b/dba/caldav_functions.sql @@ -253,23 +253,17 @@ BEGIN IF out_confers = tmp_confers THEN RETURN dbg || out_confers; ELSE - IF tmp_confers ~* ''A'' AND NOT tmp_confers ~* ''BRWU'' THEN - -- Ensure that A is expanded to all privs - tmp_confers := tmp_confers || ''BRWU''; - END IF; - IF (SELECT substring(setting,1,3)::numeric >= 8.1 FROM pg_settings WHERE name = ''server_version'') THEN - -- PostgreSQL 8.1 or later. regexp_replace exists! - out_confers := regexp_replace( out_confers, ''([^'' || tmp_confers || '']*)'', '''' ); - RETURN dbg || out_confers; - ELSE - tmp_txt = ''''; - FOR counter IN 1 .. length(tmp_confers) LOOP - IF out_confers ~* substring(tmp_confers,counter,1) THEN - tmp_txt := tmp_txt || substring(tmp_confers,counter,1); - END IF; - END LOOP; - RETURN dbg || tmp_txt; + IF tmp_confers ~* ''A'' AND NOT tmp_confers ~* ''FBRWU'' THEN + -- Ensure that A is expanded to all supported privs before being used as a mask + tmp_confers := tmp_confers || ''FBRWU''; END IF; + tmp_txt = ''''; + FOR counter IN 1 .. length(tmp_confers) LOOP + IF out_confers ~* substring(tmp_confers,counter,1) THEN + tmp_txt := tmp_txt || substring(tmp_confers,counter,1); + END IF; + END LOOP; + RETURN dbg || tmp_txt; END IF; END IF;