Re: SIMILAR TO

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rommel the iCeMAn <icecrew(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SIMILAR TO
Date: 2010-10-16 14:30:14
Message-ID: 6862.1287239414@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rommel the iCeMAn <icecrew(at)gmail(dot)com> writes:
> I use the following code to detect alphanumeric strings:

> IF _my_variable SIMILAR TO '^[a-zA-Z0-9]+$' THEN
> // do stuff here
> END IF;

> In pg8.4 this worked perfectly. I upgraded to pg9.0 and it no longer
> works. From the release notes it appears that the behavior of SIMILAR
> TO has changed in pg9.0. My question is, how do I modify my code so
> that it works in 9.0?

Drop the ^ and $; they are incorrect for SIMILAR TO.

regards, tom lane

In response to

  • SIMILAR TO at 2010-10-16 14:26:46 from Rommel the iCeMAn

Browse pgsql-sql by date

  From Date Subject
Next Message Rommel the iCeMAn 2010-10-16 16:23:24 Re: SIMILAR TO
Previous Message Rommel the iCeMAn 2010-10-16 14:26:46 SIMILAR TO