> -----Original Message-----
> From: Gregory Stark [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 11, 2007 2:41 PM
> To: Dann Corbit
> Cc: Martijn van Oosterhout; firstname.lastname@example.org; Larry McGhaw
> Subject: Re: [HACKERS] Selecting a constant question
> "Dann Corbit" <[EMAIL PROTECTED]> writes:
> > Surely, we cannot be the only people who will need this information.
> > (for example) someone wants to bind to a grid, then the maximum size
> > to be known in advance.
> In fact psql needs it and implements this. It has to skim through the
> result set to calculate the column widths. It's quite a lot of work
> server is in no better position to do it than psql.
Reading the data twice sounds a little painful. What if there are 30
> On the contrary the server is missing quite a bit of information of
> intend to display the information. Do you need the number of bytes or
> characters? Are all the characters the same width in your display
> about currency symbols? Do you intend to reverse any quoting or just
Giving me the information about the data type will be enough. As an
example, in this case we have varchar data. If the server should be so
kind as to report varchar(1) for '1' or varchar(3) for '123' then I
would not have any difficulty binding the data to a grid.
> Even knowing how many characters and assuming fixed character widths
> wouldn't even be enough to set your grid control widths. Usually
> numeric quantities decimal aligned and so two records "1.00" and
> take much more width than two records with "1.00" and "2.00".
SQL*Server, Oracle, Ingres, DB/2 and other database systems somehow
manage to do it, so I guess it is not technically intractable.
I suspect that your own ODBC/JDBC and other drivers suffer from this
Now, I do recognize that sometimes nobody is going to know how big
something is, including the server. But with a query using a constant
it seems like it ought to be well defined to me. Perhaps the
difficulties are escaping me because I am not familiar with the low
level guts of this problem. But I suspect that lots of people besides
me would benefit if sizes of things were known when it is possible to
As I said before, I see that it cannot be known right now. So I am
putting it in as a feature request.
If you could be so kind as to point out the right spot to look in the
server code, I imagine we could fix it and check in the patch ourselves.
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?