Re: Libpq: PQftype, PQfsize - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Libpq: PQftype, PQfsize
Date
Msg-id 3103.1281462046@sss.pgh.pa.us
Whole thread Raw
In response to Libpq: PQftype, PQfsize  ("Bozena Potempa" <Bozena.Potempa@otc.pl>)
Responses Re: Libpq: PQftype, PQfsize
List pgsql-hackers
"Bozena Potempa" <Bozena.Potempa@otc.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)
Next
From: Tom Lane
Date:
Subject: Re: 8.3 to 8.4 Upgrade issues