Re: Libpq: PQftype, PQfsize

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bozena Potempa" <Bozena(dot)Potempa(at)otc(dot)pl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Libpq: PQftype, PQfsize
Date: 2010-08-10 17:40:46
Message-ID: 3103.1281462046@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Bozena Potempa" <Bozena(dot)Potempa(at)otc(dot)pl> writes:
> I have a test table with varchar(40) column. After executing the following
> query:
> select substr(fc,1,2) from test
> PQftype returns for the result column PG_TYPE_TEXT and PQfsize returns -1.
> Is it the expected behaviour?

Yes. substr() returns text. But even if it returned varchar, you'd
probably get -1 for the fsize. PG does not make any attempt to predict
the result width of functions.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-10 17:49:41 Re: 8.3 to 8.4 Upgrade issues
Previous Message Tom Lane 2010-08-10 17:35:30 Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)