Re: syntax error on Function return setoff - Mailing list pgsql-novice

From David G. Johnston
Subject Re: syntax error on Function return setoff
Date
Msg-id CAKFQuwba1sr1FbBB9Qt+ExXC9-vmeNQTJrA1iNFM3qpw_bNpqw@mail.gmail.com
Whole thread Raw
In response to syntax error on Function return setoff  (Garry Chen <gc92@cornell.edu>)
List pgsql-novice

On Friday, January 26, 2018, Garry Chen <gc92@cornell.edu> wrote:

Hi All,

                I have a working function that returns setoff record was created under porstgresql 9.6 but  when I try to create the same function under release 10 it gives me error type”recode” does not exist.  Therefore, I changed it to RETURNS SETOF table_name.column%varachar(7) I got syntax error.  Can anyone let me know the right syntax?

AFAIK there is nothing changed between 9.6 and 10 that should affect this.  Providing the complete create function statement (you can probably replace the body string with raise notice or something similar) would be helpful, but "recode" is an odd, and custom, type name...

As for the spec using "%", the point of it is to infer the data type from the named column, which means you shouldn't actually have a data type name (i.e., varchar) in the expression.  The text TYPE in the docs are the literal characters TYPE, not a syntax placeholder.  The difference is the "table.column" are in italics while "%TYPE" is not.

David J.

pgsql-novice by date:

Previous
From: Garry Chen
Date:
Subject: syntax error on Function return setoff
Next
From: Andreas Kretschmer
Date:
Subject: Re: syntax error on Function return setoff