Re: textpos() function - Mailing list pgsql-general

From Mike Mascari
Subject Re: textpos() function
Date
Msg-id 3919418A.39AE10D6@mascari.com
Whole thread Raw
In response to textpos() function  (Hitesh Patel <hitesh@presys.com>)
List pgsql-general

Hitesh Patel wrote:
>
> > If you really don't want to update your app's code just yet, you can
> > install a pg_proc entry that defines textpos() with a CREATE FUNCTION
> > command.  But the long-term answer is to fix your code to conform with
> > the standard.
> >
> >                         regards, tom lane
>
> I changed my code to use position() instead of textpos(), the only
> problem is that I now get a parse error at the following line:
>
>         i:= position(stringa, ',');
>
> The exact error message is:
>
> ERROR: parser: parse error at or near ","
>
> Trying to run a query like, 'select position(email, ',') from table'
> fails with the same parse error, however 'select strpos(email, ',') from
> table' runs fine...
>
> any hints?

This is from memory, so please verify with the docs, but I
believe the SQL92 standared is something like:

SELECT position(',' in stringa) ...

Hope that helps,

Mike Mascari

pgsql-general by date:

Previous
From: Malcolm Beattie
Date:
Subject: Re: [HACKERS] pgsql/php3/apache authentication
Next
From: Marcin Inkielman
Date:
Subject: row numbering