initializelocalnode(p_comment integer, p_local_node_id text)

8.77. initializelocalnode(p_comment integer, p_local_node_id text)

Function Properties

Language: PLPGSQL

Return Type: integer

no_id - Node ID # no_comment - Human-oriented comment Initializes the new node, no_id

	v_old_node_id		int4;
	v_first_log_no		int4;
	v_event_seq			int8;
	-- ----
	-- Make sure this node is uninitialized or got reset
	-- ----
	select last_value::int4 into v_old_node_id from sl_local_node_id;
	if v_old_node_id != -1 then
		raise exception 'Slony-I: This node is already initialized';
	end if;

	-- ----
	-- Set sl_local_node_id to the requested value and add our
	-- own system to sl_node.
	-- ----
	perform setval('sl_local_node_id', p_local_node_id);
	perform storeNode_int (p_local_node_id, p_comment);

	if (pg_catalog.current_setting('max_identifier_length')::integer - pg_catalog.length('schemadoc')) < 5 then
		raise notice 'Slony-I: Cluster name length [%] versus system max_identifier_length [%] ', pg_catalog.length('schemadoc'), pg_catalog.current_setting('max_identifier_length');
		raise notice 'leaves narrow/no room for some Slony-I-generated objects (such as indexes).';
		raise notice 'You may run into problems later!';
	end if;
	return p_local_node_id;