Re: BUG #5867: wish: plpgsql print table for debug

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Richard Neill <rn214(at)richardneill(dot)org>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Richard Neill <postgresql(at)richardneill(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5867: wish: plpgsql print table for debug
Date: 2011-03-03 17:54:40
Message-ID: AANLkTi=Yd-BwdsziHE-eyK9M5DvMy+FYqs2YUd9dgxQ3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

>
> Do you not think it would be really amazingly useful? After all, in C, the
> single most useful debugging tool is "fprintf(stderr,...)", and yet
> postgresql doesn't have an equivalent that can operate on the most common
> data format. [I'm stretching the analogy a bit here, but it seems to me that
> a multi-row table is to postgresql as int is to C.]

it's nonsense - PL/pgSQL is procedural language - so there are same -
similar types like C

>
> There are a lot of people who would benefit from it, most of whom (including
> me) don't really have the expertise to do it well.
>

I don't think so we need a special enhancing of RAISE statement. What
is a problem on lines

FOR r IN SELECT ... LOOP
RAISE NOTICE r;
END LOOP;

???

> Also, there is a lot of value in being able to debug as needed with a 1-line
> debugging statement, then get back to the problem at hand, rather than
> having to break out of the current programming task to write a debug
> function :-)
>

CREATE OR REPLACE FUNCTION debug_query(text)
RETURNS void AS $$
DECLARE r record;
BEGIN
FOR r IN EXECUTE $1 LOOP
RAISE NOTICE r;
END;
END;
$$ LANGUAGE plpgsql;

Regards

Pavel Stehule

> Thanks very much,
>
> Richard
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-03-03 18:05:31 Re: BUG #5906: assertion failure in AtCleanup_Portals
Previous Message Tom Lane 2011-03-03 17:24:21 Re: BUG #5912: Etc/GMT time utc offset error