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

From: Richard Neill <rjn(at)richardneill(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Richard Neill <rn214(at)richardneill(dot)org>, 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 18:48:11
Message-ID: 4D6FE26B.8080706@richardneill.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


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

Dear Tom,

Thanks for your help. I agree that changing the protocol would be great
overhead; I'm not really suggesting that. Perhaps I should give an
example of what I mean

(1) Consider the following table, tbl_numbers:

number | english | french | german
----------------------------------------
1 one un ein
2 two deux zwei
3 three trois drei

(2) My desired debug function would be called this:

RAISE NOTICE_DEBUG ("SELECT * from tbl_numbers")

(3) The resulting logfile would then contain multiple separate lines,
each looking a bit like this:

NOTICE: number english french german
NOTICE: 1 one un ein
NOTICE: 2 two deux zwei
NOTICE: 3 three trois drei

While pretty-printing would be nice, I agree it's not really important.
It would be nice to add the same space-padding to each field for
alignment, but delimiting with a single tab would be sufficient.

Richard

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Christian Kastner 2011-03-03 19:47:42 Possible regression: libpq + SSL aborts when user has no home directory
Previous Message Robert Haas 2011-03-03 18:45:21 Re: BUG #5867: wish: plpgsql print table for debug