From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Allan Kamau <kamauallan(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Printing command string passed to EXECUTE command in plpgsql (after argument resolution) |
Date: | 2010-10-28 15:04:57 |
Message-ID: | AANLkTinHgpvw4+0raje_KfLtRMXO-derxe6HrKeke-hO@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> 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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Clark | 2010-10-28 15:08:41 | Re: Should PQconsumeInput/PQisBusy be expensive to use? |
Previous Message | Allan Kamau | 2010-10-28 14:59:50 | Re: Printing command string passed to EXECUTE command in plpgsql (after argument resolution) |