SQL function parse error ? - Mailing list pgsql-sql

From Radu-Adrian Popescu
Subject SQL function parse error ?
Date
Msg-id 008f01c2b7d0$3733fdf0$0600a8c0@rpopescu
Whole thread Raw
Responses Re: SQL function parse error ?
Re: SQL function parse error ?
List pgsql-sql
Hello !
 
There is a strange behaviour in the SQL function parser (haven't tested this with the plpgsql lang) when using standard operators
and function parameters.
 
Take the following for example:
create or replace function testfunc1(int) returns setof test as
'
    select * from test where age>$1;
'
language sql;
 
This yealds the following error, which frankly is kind of too much :
ERROR:  Unable to identify an operator '>$' for types 'integer' and 'integer'
 
I strongly belive the parser is a bit keen on interpreting the >$ sequence as an operator. Take for instance php, where all variables start with $; " 100>$foo "
is quite valid !
 
The error goes away of course when rewriting it as " age > $1".
 
I'm afraid that taking whitespace into consideration when parsing a language is not the way to do it, except when it's python, of course :)
 
Hope this, helps,

Regards,
=====
Radu-Adrian Popescu
CSA, DBA, Developer
Aldratech Ltd.

pgsql-sql by date:

Previous
From: "Radu-Adrian Popescu"
Date:
Subject: Re: PostgreSQL X Resin EE
Next
From: Tomasz Myrta
Date:
Subject: Re: SQL function parse error ?