pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Neill <rjn@richardneill.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Richard Neill <rn214@richardneill.org>
Cc: Richard Neill <postgresql@richardneill.org>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5867: wish: plpgsql print table for debug
Date: Thu, 03 Mar 2011 18:48:11 +0000
Message-ID: <4D6FE26B.8080706@richardneill.org> (raw)
In-Reply-To: <13356.1299177149@sss.pgh.pa.us>
References: <201102070601.p1761470087214@wwwmaster.postgresql.org>
	<AANLkTimrzAYxjqFaKRjmVvXiVt_YuAVG54C9EcNW95db@mail.gmail.com>
	<4D6FCBEC.1060709@richardneill.org>
	<AANLkTinU5FwUNoGWtybEghbTw7_HH0msWrfeOfVtmsK+@mail.gmail.com>
	<13356.1299177149@sss.pgh.pa.us>


> 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






view thread (14+ messages)  latest in thread

Message-ID: <4D6FE26B.8080706@richardneill.org>
Permalink:  ../4D6FE26B.8080706@richardneill.org/
Also on:    postgresql.org/message-id/4D6FE26B.8080706@richardneill.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: rjn@richardneill.org, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, rn214@richardneill.org, postgresql@richardneill.org
  Subject: Re: BUG #5867: wish: plpgsql print table for debug
  In-Reply-To: <4D6FE26B.8080706@richardneill.org>
  References: <201102070601.p1761470087214@wwwmaster.postgresql.org> <AANLkTimrzAYxjqFaKRjmVvXiVt_YuAVG54C9EcNW95db@mail.gmail.com> <4D6FCBEC.1060709@richardneill.org> <AANLkTinU5FwUNoGWtybEghbTw7_HH0msWrfeOfVtmsK+@mail.gmail.com> <13356.1299177149@sss.pgh.pa.us> <4D6FE26B.8080706@richardneill.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox