From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Frank Cazabon <frank.cazabon@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Calling function from VFP changes character field to Memo
Date: Tue, 15 Nov 2022 10:52:49 -0800
Message-ID: <a94158a9-ff24-9a15-51f7-af265d052f90@aklaver.com> (raw)
In-Reply-To: <1177304.1668537843@sss.pgh.pa.us>
References: <fe531f0e-ff0f-9227-c879-b875dc1201d8@gmail.com>
<1177304.1668537843@sss.pgh.pa.us>
On 11/15/22 10:44 AM, Tom Lane wrote:
> Frank Cazabon <frank.cazabon@gmail.com> writes:
>
>> Any idea what I need to do to get it to return the character(30) type?
>
> There's no chance of getting back the "30" part with this structure,
> because function signatures do not carry length restrictions.
> What I expect is happening is that you get firstname as an
> unspecified-length "character" type, and something on the client
> side is deciding to cope with that by calling it "Memo" instead.
My experience is that frameworks 'see' ::text as Memo/Textarea and
::char/varchar as Input.
>
> You could perhaps work around that by defining a named composite
> type:
>
> create type testfunction_result as (firstname character(30), ...);
>
> create function testfunction() returns setof testfunction_result as ...
>
> regards, tom lane
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, tgl@sss.pgh.pa.us, frank.cazabon@gmail.com
Subject: Re: Calling function from VFP changes character field to Memo
In-Reply-To: <a94158a9-ff24-9a15-51f7-af265d052f90@aklaver.com>
References: <fe531f0e-ff0f-9227-c879-b875dc1201d8@gmail.com> <1177304.1668537843@sss.pgh.pa.us> <a94158a9-ff24-9a15-51f7-af265d052f90@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox