Re: BUG #5867: wish: plpgsql print table for debug - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5867: wish: plpgsql print table for debug
Date
Msg-id 13356.1299177149@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #5867: wish: plpgsql print table for debug  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: BUG #5867: wish: plpgsql print table for debug
Re: BUG #5867: wish: plpgsql print table for debug
List pgsql-bugs
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Mar 3, 2011 at 12:12 PM, Richard Neill <rn214@richardneill.org> wrote:
>> 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.]

> Sure it does.  You can pass the tuple to RAISE NOTICE easily enough.
> It won't have all the same bells and whistles psql would supply, but
> it prints out well enough for debugging.  Or at least it's never
> bothered me.

Note that doing anything more than RAISE NOTICE or equivalent would
imply a significant protocol change.  You can't just shove a table out
to the client, because it'll think that that's the response to the outer
SELECT (or whatever) command that called your function.  So while it'd
be kind of cool if you could invoke psql's table pretty-printing stuff
this way, the amount of work required to get there seems vastly out of
proportion to the benefit.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Robert Haas
Date:
Subject: Re: BUG #5903: Turkish encoding problem
Next
From: Robert Haas
Date:
Subject: Re: BUG #5867: wish: plpgsql print table for debug