Character escape in "CREATE FUNCTION ..."

Поиск
Список
Период
Сортировка
От Shilong Stanley Yao
Тема Character escape in "CREATE FUNCTION ..."
Дата
Msg-id 4055F80D.8060402@noao.edu
обсуждение исходный текст
Ответы Re: Character escape in "CREATE FUNCTION ..."  (Richard Huxton <dev@archonet.com>)
Re: Character escape in "CREATE FUNCTION ..."  (Bruno Wolff III <bruno@wolff.to>)
Re: Character escape in "CREATE FUNCTION ..."  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Dear All,
I am trying to write a function in Postgresql, which takes 2 floats and
returns a box.  But seems the nested single-quote in the AS clause
prevent $1 and $2 from being expanded.  Besides writing a C function
instead of a SQL one, is there any way to solve this problem?

Thanks a lot.
-Stan

CREATE OR REPLACE FUNCTION func_radec_to_box(float, float) RETURNS box
         AS 'SELECT box \'(($1, $2), (1.3, 1.4))\''
         LANGUAGE 'sql'
         WITH (ISCACHABLE);


Error message:
psql:func_radec_to_box.sql:4: ERROR:  Bad box external representation
'(($1, $2), (1.3, 1.4))'


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Deadlock Problem
Следующее
От: Jeff
Дата:
Сообщение: Re: Send a variable 123k