registry_get_text(text, text)

Slony-I 2.0.4 Documentation
Prev | Fast Backward | Chapter 1. Schema schemadoc | Fast Forward | Next

# 1.86. registry_get_text(text, text)

Function Properties

Language: PLPGSQL

Return Type: text

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

    DECLARE
    	p_key		alias for $1;
    	p_default	alias for $2;
    	v_value		text;
    BEGIN
    	select reg_text 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_text(p_key, p_default);
    		end if;
    	else
    		if v_value is null then
    			raise exception 'Slony-I: registry key % is not a text value',
    					p_key;
    		end if;
    	end if;
    	return v_value;
    END;

Prev | Home | Next
registry_get_int4(text, integer) | Up | registry_get_timestamp(text, timestamp without time zone)