Character escape in "CREATE FUNCTION ..."

From: Shilong Stanley Yao <yao(at)noao(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Character escape in "CREATE FUNCTION ..."
Date: 2004-03-15 18:38:05
Message-ID: 4055F80D.8060402@noao.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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))'

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff 2004-03-15 18:48:25 Re: Send a variable 123k
Previous Message Tom Lane 2004-03-15 18:32:06 Re: Deadlock Problem