Use um bloco de código anônimo :
DO language plpgsql $$
BEGIN
RAISE NOTICE 'hello, world!';
END
$$;
Variáveis são referenciadas usando
% :RAISE NOTICE '%', variable_name;
DO language plpgsql $$
BEGIN
RAISE NOTICE 'hello, world!';
END
$$;
% :RAISE NOTICE '%', variable_name;