ahoward <ahoward(at)fsl(dot)noaa(dot)gov> writes:
> i've looked through to docs a bit, but have not found a way to quickly
> calculate the maximum fieldwidth of each field in a tuple set.
There is no general-purpose method for doing that.
> obviously psql does something internally to do it's formatting, but whatever
> it does is very fast... any ideas?
psql runs through the actual strings returned by the query and takes the
max length in each column. Not very brilliant ...
regards, tom lane