SQL function parse error ?

Поиск
Список
Период
Сортировка
От Radu-Adrian Popescu
Тема SQL function parse error ?
Дата
Msg-id 008f01c2b7d0$3733fdf0$0600a8c0@rpopescu
обсуждение исходный текст
Ответы Re: SQL function parse error ?
Re: SQL function parse error ?
Список 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 по дате отправления: