Re: CREATE FUNCTION problem - Mailing list pgsql-general

From Tom Lane
Subject Re: CREATE FUNCTION problem
Date
Msg-id 26892.973199700@sss.pgh.pa.us
Whole thread Raw
In response to CREATE FUNCTION problem  ("Cesar A. K. Grossmann" <cesar@rotnet.com.br>)
List pgsql-general
"Cesar A. K. Grossmann" <cesar@rotnet.com.br> writes:
> create function
> vinculoExportacao (varchar)
> returns setof
> as 'select codigo, nome, ''T'' as selected
> from cad_exportacao
> ...
> psql:tmp/teste2.sql:15: ERROR:  parser: parse error at or near "as"

setof *what* ?  The parser is expecting SETOF typename.  In this case
you are going to need a tuple type that corresponds to the row structure
you want to return a set of.

BTW, please see my post from a week or two back that describes the known
problems with functions returning tuples and sets ...

            regards, tom lane

pgsql-general by date:

Previous
From: Warren Vanichuk
Date:
Subject: Re: Does this table exist?
Next
From: Norman Clarke
Date:
Subject: Re: Speed issues with update