Обсуждение: 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,
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 ...

On Tue, Apr 9, 2013 at 10:01 AM, Dave Page <dpage@pgadmin.org> wrote:
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

От
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.

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,

On Tue, Apr 9, 2013 at 10:53 AM, Dave Page <dpage@pgadmin.org> wrote:
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

От
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