Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 697471337B69 for ; Thu, 3 Mar 2011 14:32:38 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 51878-05-2 for ; Thu, 3 Mar 2011 18:32:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 413391337BD6 for ; Thu, 3 Mar 2011 14:32:30 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p23IWTEo013357; Thu, 3 Mar 2011 13:32:29 -0500 (EST) To: Robert Haas cc: Richard Neill , Richard Neill , pgsql-bugs@postgresql.org Subject: Re: BUG #5867: wish: plpgsql print table for debug In-reply-to: References: <201102070601.p1761470087214@wwwmaster.postgresql.org> <4D6FCBEC.1060709@richardneill.org> Comments: In-reply-to Robert Haas message dated "Thu, 03 Mar 2011 13:12:08 -0500" Date: Thu, 03 Mar 2011 13:32:29 -0500 Message-ID: <13356.1299177149@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/68 X-Sequence-Number: 29578 Robert Haas writes: > On Thu, Mar 3, 2011 at 12:12 PM, Richard Neill 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