registry_get_timestamp(p_default text, p_key timestamp with time zone)

Slony-I 2.2.10 Documentation
Prev | Fast Backward | Chapter 8. Schema schemadoc | Fast Forward | Next

# 8.88. registry_get_timestamp(p_default text, p_key timestamp with time zone)

Function Properties

Language: PLPGSQL

Return Type: timestamp without time zone

registry_get_timestamp(key, value) Get a registry value. If not present, set and return the default.

    DECLARE
    	v_value		timestamp;
    BEGIN
    	select reg_timestamp into v_value from sl_registry
    			where reg_key = p_key;
    	if not found then
    		v_value = p_default;
    		if p_default notnull then
    			perform registry_set_timestamp(p_key, p_default);
    		end if;
    	else
    		if v_value is null then
    			raise exception 'Slony-I: registry key % is not an timestamp value',
    					p_key;
    		end if;
    	end if;
    	return v_value;
    END;

Prev | Home | Next
registry_get_text(p_default text, p_key text) | Up | registry_set_int4(p_value text, p_key integer)