On 21/03/2008, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Brendan Jurd" <direvus@gmail.com> writes:
> > We can't just build the output table by hand like
> > describeOneTableDetails does? Admittedly it's kludgy, but it's not an
> > unprecedented kludge.
>
>
> Oh, I had forgotten the existence of that entry point in print.c. Yeah,
> it might be workable --- want to have a go at it?
>
I've had a chance to look at this now, and although it certainly does
seem workable, there's a lot of duplication of code that I feel uneasy
about. describeOneTableDetails essentially already duplicates the
table buildling code in printQuery, so I would be creating a third
copy of the same logic.
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?