Обсуждение: I'm having problem with Slony-I
Hi,
I installed a Slony-I cluster on a test database on my production server. When I try to join this new cluster from my test database on my development server, I always got this error:
----------------------------------------------
An error has occurred:
ERROR: syntax error at or near “$” at character 1959
----------------------------------------------
This is the SQL near the character 1959 (AS $_$):
----------------------------------------------
--
-- Name: add_missing_table_field(text, text, text, text); Type: FUNCTION; Schema: _MY_Cluster; Owner: postgres
--
CREATE FUNCTION add_missing_table_field(text, text, text, text) RETURNS boolean
AS $_$
DECLARE
p_namespace alias for $1;
p_table alias for $2;
p_field alias for $3;
p_type alias for $4;
v_row record;
v_query text;
BEGIN
select 1 into v_row from pg_namespace n, pg_class c, pg_attribute a
where "_MY_Cluster".slon_quote_brute(n.nspname) = p_namespace and
c.relnamespace = n.oid and
"_MY_Cluster".slon_quote_brute(c.relname) = p_table and
a.attrelid = c.oid and
"_MY_Cluster".slon_quote_brute(a.attname) = p_field;
if not found then
raise notice 'Upgrade table %.% - add field %', p_namespace, p_table, p_field;
v_query := 'alter table ' || p_namespace || '.' || p_table || ' add column ';
v_query := v_query || p_field || ' ' || p_type || ';';
execute v_query;
return 't';
else
return 'f';
end if;
END;$_$
LANGUAGE plpgsql;
---------------------------------------------------
Could you help me please with this error?
Thank you
Renaud Fortier