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

From Florian G. Pflug
Subject Re: Selecting a constant question
Date
Msg-id 466E765B.1010001@phlo.org
Whole thread Raw
In response to Re: Selecting a constant question  ("Dann Corbit" <DCorbit@connx.com>)
Responses Re: Selecting a constant question  ("Zeugswetter Andreas ADI SD" <ZeugswetterA@spardat.at>)
List pgsql-hackers
Dann Corbit wrote:
>> -----Original Message-----
>> From: Hannu Krosing [mailto:hannu@skype.net]
>>> Since libpq function PQfsize returns -2 for all constant character
>>> strings in SQL statements ... What is the proper procedure to determine
>>> the length of a constant character column after query execution but
>>> before fetching the first row of data?
>> Why not just get the first row and determine the width from it before
>> you actually use any of tha data ?
> 
> What if the second row is 1000x longer?

Thats exactly the point. Consider
select mytext from mytable ;

How can PostgreSQL possibly know the maximum length
of the returned values *before* it has scanned the
whole table?

greetings, Florian Pflug



pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Selecting a constant question
Next
From: Magnus Hagander
Date:
Subject: Re: Autovacuum launcher doesn't notice death of postmaster immediately