On 28 Sep 2001, Wei Weng wrote:
> Hi there. I wrote a simple postgresql sql function as follows:
>
> create function test() returns integer as '
> begin
> fixed_path := translate (''/text'', ''\\'', ''/'');
> raise notice ''fixed_path:'', fixed_path;
> return 1;
> end
> ' language 'plpgsql';
>
> And when I ran it as
>
> pgsql>select test();
>
> I got:
>
> NOTICE: plpgsql: ERROR during compile of test near line 8
> ERROR: unterminated string starting on line 10
>
> What is wrong? (something fishy about translate function?) Could anyone
> enlighten me on this?
I think you need to use four backslashes to do the quoting for the
backslash. Plus you're going to need to declare that variable.