pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Radu-Adrian Popescu <radu.popescu@aldratech.com>
To: pgsql-sql@postgresql.org
Subject: SQL function parse error ?
Date: Thu, 9 Jan 2003 13:14:02 +0200
Message-ID: <008f01c2b7d0$3733fdf0$0600a8c0@rpopescu> (raw)

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.

view thread (19+ messages)  latest in thread

Message-ID: <008f01c2b7d0$3733fdf0$0600a8c0@rpopescu>
Permalink:  ../008f01c2b7d0$3733fdf0$0600a8c0@rpopescu/
Also on:    postgresql.org/message-id/008f01c2b7d0$3733fdf0$0600a8c0@rpopescu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: radu.popescu@aldratech.com
  Subject: Re: SQL function parse error ?
  In-Reply-To: <008f01c2b7d0$3733fdf0$0600a8c0@rpopescu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox