Re: Selecting a constant question - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Selecting a constant question
Date
Msg-id 87ejkinp9e.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: Selecting a constant question  ("Dann Corbit" <DCorbit@connx.com>)
Responses Re: Selecting a constant question  ("Dann Corbit" <DCorbit@connx.com>)
List pgsql-hackers
"Dann Corbit" <DCorbit@connx.com> writes:

> Surely, we cannot be the only people who will need this information.  If
> (for example) someone wants to bind to a grid, then the maximum size has
> to be known in advance.

In fact psql needs it and implements this. It has to skim through the entire
result set to calculate the column widths. It's quite a lot of work but the
server is in no better position to do it than psql.

On the contrary the server is missing quite a bit of information of how you
intend to display the information. Do you need the number of bytes or
characters? Are all the characters the same width in your display system? What
about currency symbols? Do you intend to reverse any quoting or just display
backslashes?

Even knowing how many characters and assuming fixed character widths that
wouldn't even be enough to set your grid control widths. Usually people like
numeric quantities decimal aligned and so two records "1.00" and "0.01" will
take much more width than two records with "1.00" and "2.00".

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: "Dann Corbit"
Date:
Subject: Re: Selecting a constant question
Next
From: "Dann Corbit"
Date:
Subject: Re: Selecting a constant question