pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rommel the iCeMAn <icecrew@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: SIMILAR TO
Date: Sat, 16 Oct 2010 10:30:14 -0400
Message-ID: <6862.1287239414@sss.pgh.pa.us> (raw)
In-Reply-To: <AANLkTin0sFTh=A6nPUj8dfumGRbALJT=cJrBew6mxxfK@mail.gmail.com>
References: <AANLkTin0sFTh=A6nPUj8dfumGRbALJT=cJrBew6mxxfK@mail.gmail.com>

Rommel the iCeMAn <icecrew@gmail.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



view thread (3+ messages)  latest in thread

Message-ID: <6862.1287239414@sss.pgh.pa.us>
Permalink:  ../6862.1287239414@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6862.1287239414@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, icecrew@gmail.com
  Subject: Re: SIMILAR TO
  In-Reply-To: <6862.1287239414@sss.pgh.pa.us>

* 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