From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Garry Chen <gc92(at)cornell(dot)edu> |
Cc: | "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: syntax error on Function return setoff |
Date: | 2018-01-26 18:52:13 |
Message-ID: | CAKFQuwba1sr1FbBB9Qt+ExXC9-vmeNQTJrA1iNFM3qpw_bNpqw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Friday, January 26, 2018, Garry Chen <gc92(at)cornell(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Kretschmer | 2018-01-26 18:54:47 | Re: syntax error on Function return setoff |
Previous Message | Garry Chen | 2018-01-26 18:39:27 | syntax error on Function return setoff |