Re: Point and function help
| От | Tom Lane |
|---|---|
| Тема | Re: Point and function help |
| Дата | |
| Msg-id | 20664.1072370632@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Point and function help ("Andy Lewis" <jumboc@comcast.net>) |
| Ответы |
Re: Point and function help
|
| Список | pgsql-sql |
"Andy Lewis" <jumboc@comcast.net> writes:
> CREATE OR REPLACE FUNCTION public.map_point(pg_catalog.varchar,
> pg_catalog.varchar, pg_catalog.varchar)
> RETURNS point AS
> 'SELECT map_loc from zip_code where zip = \'$3\' and lower(state) =
> lower(\'$2\') and lower(city) = lower(\'$1\')'
> LANGUAGE 'sql' VOLATILE;
You don't want to quote the parameter references --- what you've got
there is simple literal constants '$3' etc. Try
CREATE OR REPLACE FUNCTION public.map_point(pg_catalog.varchar,
pg_catalog.varchar, pg_catalog.varchar) RETURNS point AS
'SELECT map_loc from zip_code where zip = $3 and lower(state) =
lower($2) and lower(city) = lower($1)' LANGUAGE 'sql' VOLATILE;
Also, I can't see any reason why this function needs to be VOLATILE;
STABLE should be enough, no?
regards, tom lane
В списке pgsql-sql по дате отправления: