CREATE OR REPLACE FUNCTION food600.updatepolastring(
	oldpole character varying,
	newpole character varying,
	INOUT pocetzmien integer,
	INOUT ret character varying,
	INOUT ret_master character varying,
	meno character varying)
    RETURNS record
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE PARALLEL UNSAFE
AS $BODY$
BEGIN
IF (newpole != oldpole) THEN 
	IF pocetzmien>0 THEN
		ret:=ret||',';
		ret_master:=ret_master||',';
	END IF;
	ret:=ret||meno||'=''' ||btrim(newpole)||'''';
	ret_master:=ret_master||meno||'=''' ||REPLACE(btrim(newpole),'''','''''')||'''';
	pocetzmien:=pocetzmien+1;
END IF;
END
$BODY$;
