Search Postgresql Archives

Re: Printing command string passed to EXECUTE command in plpgsql (after argument resolution)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I could use the RAISE NOTICE could work but I will have to write
> another command string and use % in place of the $<somenumber> for the
> parameters, one string for RAISE NOTICE and the other for EXECUTE.
> This may potentially introduce some differences (due to human error)
> between the output of RAISE NOTICE and the command string executed
> after parameter solution during the call to EXECUTE.
>

you can simply minimalize these risks

CREATE OR REPLACE FUNCTION notice(text, boolena)
RETURNS text AS $$
BEGIN
  IF $2 THEN
    RAISE NOTICE '%', $1;
  END IF;
  RETURN $1;
END;
$$ LANGUAGE plpgsql;

and then you can use it in EXECUTE

EXECUTE notice('SELECT ....', true) USING ...

Regards

Pavel Stehule

> Pavel's suggestion to use 'auto_explain' contrib module may be one of
> the probable solutions.
>
> Allan.
>
> --
> Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux