On Tue, Mar 25, 2008 at 2:41 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > "Brendan Jurd" <[EMAIL PROTECTED]> writes: > > This makes me wonder whether print.c could offer something a bit more > > helpful to callers wishing to DIY a table; we could have a > > table-building struct with methods like addHeader and addCell. > > > What do you think? Overkill, or worthy pursuit? > > Once you have two occurrences of a pattern, it's reasonable to assume > there will be more later. +1 for building a little bit of infrastructure. >
I've written a patch which implements the same \du behaviour as my previous patch, but using the new printTable API I submitted in [1]. If the printTable API patch is rejected or substantially changed, we will need to revisit this patch. The new patch constructs a table manually, in the same manner as describeOneTableDetails, so that we get the same outputs as the original patch but without any of the localisation issues identified by Tom and Alvaro. I have attached a patch against my printTable code, containing only the changes I made to describeRoles() (du-attributes_1.diff.bz2), and a combined patch against HEAD containing the full printTable API changes as well as the changes to describeRoles() (du-attributes-print-table_1.diff.bz2). No memory problems detected by valgrind, and all regression tests passed on x86_64 gentoo. I've added this item to the May CommitFest wiki page. Cheers, BJ [1[ http://archives.postgresql.org/message-id/[EMAIL PROTECTED]
du-attributes_1.diff.bz2
Description: BZip2 compressed data
du-attributes-print-table_1.diff.bz2
Description: BZip2 compressed data
-- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-patches