Re: Selecting a constant question

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: Dann Corbit <DCorbit(at)connx(dot)com>
Cc: Hannu Krosing <hannu(at)skype(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Selecting a constant question
Date: 2007-06-12 10:32:59
Message-ID: 466E765B.1010001@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dann Corbit wrote:
>> -----Original Message-----
>> From: Hannu Krosing [mailto:hannu(at)skype(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2007-06-12 10:37:29 Re: Autovacuum launcher doesn't notice death of postmaster immediately
Previous Message Gregory Stark 2007-06-12 10:30:57 Re: Selecting a constant question