Re: RETURNS SETOF RECORD with 1 column

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: RETURNS SETOF RECORD with 1 column
Date: 2017-07-27 14:03:22
Message-ID: 21856.1501164202@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it> writes:
> CREATE OR REPLACE FUNCTION afun1( OUT ot TEXT )
> RETURNS SETOF RECORD

> The error message for afun1() reads:
> ERROR: function result type must be text because of OUT parameters

Indeed. It's trying to protect you from simple typos.

If you want a consistent syntax I'd suggest

CREATE OR REPLACE FUNCTION afun1() RETURNS TABLE (ot text) ...

It's still really "setof text" under the hood.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vincenzo Romano 2017-07-27 14:20:46 Re: RETURNS SETOF RECORD with 1 column
Previous Message Scott Marlowe 2017-07-27 12:58:35 Re: Interesting streaming replication issue