Обсуждение: Problem with DEBUG messages

Поиск
Список
Период
Сортировка

Problem with DEBUG messages

От
Michael Shapiro
Дата:
Hi Dave,<br /><br />I reported a problem I am having with PgAdmin and DEBUG messages (April 2nd). There has been no
repsonse.I am pretty sure it is a PgAdmin issue, as other tools show the DEBUG messages but they do not show in
PgAdmin.<br/><br />==============<br />Message ID: CAGCvxeb6KStFf95QAcCmo7sc49nvS6usEKV_ntthLrO2Taf=<a
href="mailto:7w@mail.gmail.com">7w@mail.gmail.com</a><br/><br />I have procedures which issue RAISE DEBUG stmts. The
outputfrom these stmts does not show up in PgAdmin. They do show up in psql.<br /><br />Is there a PgAdmin option to
suppress/showthe DEBUG statements.<br /><br />I have client_min_messages set to debug1 (and again this works with psql
butnot PgAdmin)<br /><br />I am running PostgreSQL 9.2.3, PgAdmin 1.16.1<br /><br /><br /> 

Re: Problem with DEBUG messages

От
Dave Page
Дата:
Hi

On Mon, Apr 8, 2013 at 5:58 PM, Michael Shapiro <mshapiro51@gmail.com> wrote:
> Hi Dave,
>
> I reported a problem I am having with PgAdmin and DEBUG messages (April
> 2nd). There has been no repsonse. I am pretty sure it is a PgAdmin issue, as
> other tools show the DEBUG messages but they do not show in PgAdmin.

It works for me (form the history pane):

-- Executing query:
CREATE OR REPLACE FUNCTION test_debug(val integer) RETURNS integer AS
$$
DECLARE
BEGIN   IF val > 0 THEN       RAISE DEBUG 'Value: %', val;       RETURN val;   ELSE       RETURN 0;   END IF;
END;
$$
LANGUAGE 'plpgsql' IMMUTABLE;

SET client_min_messages to 'DEBUG';

SELECT test_debug(1)

DEBUG:  Value: 1
Total query runtime: 13 ms.

1 row retrieved.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: Problem with DEBUG messages

От
Michael Shapiro
Дата:
I have a very similar function and client_min_message set exactly the same,<br />When I run the procedure in the query
tool,I do not see any DEBUG message.<br />If I run it in PSQL console, the DEBUG message appear.<br /><br />There must
besomething in PgAdmin that is doing this ...<br /><br /><div class="gmail_quote">On Tue, Apr 9, 2013 at 10:01 AM, Dave
Page<span dir="ltr"><<a href="mailto:dpage@pgadmin.org" target="_blank">dpage@pgadmin.org</a>></span> wrote:<br
/><blockquoteclass="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi<br /><div
class="im"><br/> On Mon, Apr 8, 2013 at 5:58 PM, Michael Shapiro <<a
href="mailto:mshapiro51@gmail.com">mshapiro51@gmail.com</a>>wrote:<br /> > Hi Dave,<br /> ><br /> > I
reporteda problem I am having with PgAdmin and DEBUG messages (April<br /> > 2nd). There has been no repsonse. I am
prettysure it is a PgAdmin issue, as<br /> > other tools show the DEBUG messages but they do not show in PgAdmin.<br
/><br/></div>It works for me (form the history pane):<br /><br /> -- Executing query:<br /> CREATE OR REPLACE FUNCTION
test_debug(valinteger)<br />   RETURNS integer AS<br /> $$<br /> DECLARE<br /> BEGIN<br />     IF val > 0 THEN<br />
       RAISE DEBUG 'Value: %', val;<br />         RETURN val;<br />     ELSE<br />         RETURN 0;<br />     END
IF;<br/> END;<br /> $$<br /> LANGUAGE 'plpgsql' IMMUTABLE;<br /><br /> SET client_min_messages to 'DEBUG';<br /><br />
SELECTtest_debug(1)<br /><br /> DEBUG:  Value: 1<br /> Total query runtime: 13 ms.<br /><br /> 1 row retrieved.<br
/><br/> --<br /> Dave Page<br /> Blog: <a href="http://pgsnake.blogspot.com"
target="_blank">http://pgsnake.blogspot.com</a><br/> Twitter: @pgsnake<br /><br /> EnterpriseDB UK: <a
href="http://www.enterprisedb.com"target="_blank">http://www.enterprisedb.com</a><br /> The Enterprise PostgreSQL
Company<br/></blockquote></div><br /> 

Re: Problem with DEBUG messages

От
Dave Page
Дата:
On Tue, Apr 9, 2013 at 4:47 PM, Michael Shapiro <mshapiro51@gmail.com> wrote:
> I have a very similar function and client_min_message set exactly the same,
> When I run the procedure in the query tool, I do not see any DEBUG message.
> If I run it in PSQL console, the DEBUG message appear.
>
> There must be something in PgAdmin that is doing this ...
>

Does my test script work for you?

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: Problem with DEBUG messages

От
Michael Shapiro
Дата:
Yes and no.<br /><br />If I run the script that creates the function, does the set client_min_messages, then runs the
function,<br/>I get the DEBUG.<br /><br />But then if I just runt he function (in a new query window). I do not get the
DEBUGmessages.<br /><br />However, if I add<br /><br />    SET client_min_messages to 'DEBUG';<br /><br />in the query
windowbefore I run the function, I see the messages.<br /><br />So<br /><br />  select test_debug(1)<br /><br />doesn't
work,but<br /><br /><br />   SET client_min_messages to 'DEBUG';<br />   select test_debug(1)<br /><br />does work,<br
/><br/><div class="gmail_quote">On Tue, Apr 9, 2013 at 10:53 AM, Dave Page <span dir="ltr"><<a
href="mailto:dpage@pgadmin.org"target="_blank">dpage@pgadmin.org</a>></span> wrote:<br /><blockquote
class="gmail_quote"style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Apr 9,
2013at 4:47 PM, Michael Shapiro <<a href="mailto:mshapiro51@gmail.com">mshapiro51@gmail.com</a>> wrote:<br />
>I have a very similar function and client_min_message set exactly the same,<br /> > When I run the procedure in
thequery tool, I do not see any DEBUG message.<br /> > If I run it in PSQL console, the DEBUG message appear.<br />
><br/> > There must be something in PgAdmin that is doing this ...<br /> ><br /><br /></div>Does my test
scriptwork for you?<br /><div class="HOEnZb"><div class="h5"><br /> --<br /> Dave Page<br /> Blog: <a
href="http://pgsnake.blogspot.com"target="_blank">http://pgsnake.blogspot.com</a><br /> Twitter: @pgsnake<br /><br />
EnterpriseDBUK: <a href="http://www.enterprisedb.com" target="_blank">http://www.enterprisedb.com</a><br /> The
EnterprisePostgreSQL Company<br /></div></div></blockquote></div><br /> 

Re: Problem with DEBUG messages

От
Dave Page
Дата:
On Tue, Apr 9, 2013 at 5:00 PM, Michael Shapiro <mshapiro51@gmail.com> wrote:
> Yes and no.
>
> If I run the script that creates the function, does the set
> client_min_messages, then runs the function,
> I get the DEBUG.
>
> But then if I just runt he function (in a new query window). I do not get
> the DEBUG messages.
>
> However, if I add
>
>     SET client_min_messages to 'DEBUG';
>
> in the query window before I run the function, I see the messages.
>
> So
>
>   select test_debug(1)
>
> doesn't work, but
>
>
>    SET client_min_messages to 'DEBUG';
>    select test_debug(1)
>
> does work,

After digging a bit further, this appears to be because pgAdmin's
connection management class runs this when it establishes a new
connection:

SET DateStyle=ISO;\nSET client_min_messages=notice;

in order to ensure that things are set up as expected. So, I'd suggest
just resetting client_min_messages if necessary when opening a query
window.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company