Re: Calling function from VFP changes character field to Memo

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Frank Cazabon <frank(dot)cazabon(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Calling function from VFP changes character field to Memo
Date: 2022-11-15 18:26:53
Message-ID: 144d91c5-e0e6-4669-6c88-700ddaeee52b@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/15/22 9:44 AM, Frank Cazabon wrote:
> Hi,
>
> I have a simple table Patients with one field FirstName of type
> character(30).
>
> If I
>
> SELECT FirstName From public.patients;
>
> I get back the expected character(30) field.
>
> If however I have a function defined like this
>
> CREATE OR REPLACE FUNCTION public.testfunction(
>     )
>     RETURNS TABLE
>     (
>         Firstname character(30)
>     )
>     LANGUAGE 'plpgsql'
>
>
> AS $BODY$
> BEGIN
>     RETURN QUERY SELECT p.cFirstName FROM patients p;

In the first query the field name is FirstName not cFirstName.

Is this a typo or are they different fields?

> END;
> $BODY$;
>
> And I call:
>
> SELECT * FROM public.testFunction();

SELECT firstname from FROM public.testFunction();

>
> Then FirstName returns as a Memo field (similar to a Text field).
>
> Any idea what I need to do to get it to return the character(30) type?
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-11-15 18:44:03 Re: Calling function from VFP changes character field to Memo
Previous Message Frank Cazabon 2022-11-15 17:44:13 Calling function from VFP changes character field to Memo