pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Frank Cazabon <frank.cazabon@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Calling function from VFP changes character field to Memo
Date: Tue, 15 Nov 2022 10:26:53 -0800
Message-ID: <144d91c5-e0e6-4669-6c88-700ddaeee52b@aklaver.com> (raw)
In-Reply-To: <fe531f0e-ff0f-9227-c879-b875dc1201d8@gmail.com>
References: <fe531f0e-ff0f-9227-c879-b875dc1201d8@gmail.com>

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.klaver@aklaver.com





view thread (11+ messages)  latest in thread

Message-ID: <144d91c5-e0e6-4669-6c88-700ddaeee52b@aklaver.com>
Permalink:  ../144d91c5-e0e6-4669-6c88-700ddaeee52b@aklaver.com/
Also on:    postgresql.org/message-id/144d91c5-e0e6-4669-6c88-700ddaeee52b@aklaver.com

 · 

reply

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, frank.cazabon@gmail.com
  Subject: Re: Calling function from VFP changes character field to Memo
  In-Reply-To: <144d91c5-e0e6-4669-6c88-700ddaeee52b@aklaver.com>
  References: <fe531f0e-ff0f-9227-c879-b875dc1201d8@gmail.com> <144d91c5-e0e6-4669-6c88-700ddaeee52b@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