Re: [GENERAL] RETURNS SETOF RECORD with 1 column - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] RETURNS SETOF RECORD with 1 column
Date
Msg-id 21856.1501164202@sss.pgh.pa.us
Whole thread Raw
In response to [GENERAL] RETURNS SETOF RECORD with 1 column  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Responses Re: [GENERAL] RETURNS SETOF RECORD with 1 column  (Vincenzo Romano <vincenzo.romano@notorand.it>)
List pgsql-general
Vincenzo Romano <vincenzo.romano@notorand.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


pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: [GENERAL] Interesting streaming replication issue
Next
From: Vincenzo Romano
Date:
Subject: Re: [GENERAL] RETURNS SETOF RECORD with 1 column