SQL function parse error ?

From: "Radu-Adrian Popescu" <radu(dot)popescu(at)aldratech(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: SQL function parse error ?
Date: 2003-01-09 11:14:02
Message-ID: 008f01c2b7d0$3733fdf0$0600a8c0@rpopescu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tomasz Myrta 2003-01-09 11:56:18 Re: SQL function parse error ?
Previous Message Radu-Adrian Popescu 2003-01-09 10:42:01 Re: PostgreSQL X Resin EE