Index: openacs-4/packages/acs-kernel/sql/postgresql/security-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/security-create.sql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-kernel/sql/postgresql/security-create.sql 30 Jun 2015 21:08:32 -0000 1.9 +++ openacs-4/packages/acs-kernel/sql/postgresql/security-create.sql 3 Sep 2024 15:37:33 -0000 1.10 @@ -51,7 +51,7 @@ select nextval('t_sec_id_seq') as nextval; -select define_function_args('sec_session_property__upsert','session_id,module,name,secure_p,last_hit'); +select define_function_args('sec_session_property__upsert','session_id,module,name,value,secure_p,last_hit'); CREATE OR REPLACE FUNCTION sec_session_property__upsert( p_session_id bigint, @@ -65,23 +65,23 @@ BEGIN LOOP -- first try to update the key - update sec_session_properties + update sec_session_properties set property_value = p_value, secure_p = p_secure_p, last_hit = p_last_hit where session_id = p_session_id and module = p_module and property_name = p_name; - IF found THEN - return; - END IF; - -- not there, so try to insert the key - -- if someone else inserts the same key concurrently, - -- we could get a unique-key failure - BEGIN - insert into sec_session_properties - (session_id, module, property_name, secure_p, last_hit) - values (p_session_id, p_module, p_name, p_secure_p, p_last_hit); - RETURN; - EXCEPTION WHEN unique_violation THEN - -- Do nothing, and loop to try the UPDATE again. - END; + IF found THEN + RETURN; + END IF; + -- not there, so try to insert the key + -- if someone else inserts the same key concurrently, + -- we could get a unique-key failure + BEGIN + insert into sec_session_properties + (session_id, module, property_name, property_value, secure_p, last_hit) + values (p_session_id, p_module, p_name, p_value, p_secure_p, p_last_hit); + RETURN; + EXCEPTION WHEN unique_violation THEN + -- Do nothing, and loop to try the UPDATE again. + END; END LOOP; END; $$ LANGUAGE plpgsql;