Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id C769F1337B97 for ; Sat, 16 Oct 2010 11:30:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 67938-04 for ; Sat, 16 Oct 2010 14:30:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 5EFEA1337B95 for ; Sat, 16 Oct 2010 11:30:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9GEUEaL006863; Sat, 16 Oct 2010 10:30:14 -0400 (EDT) To: Rommel the iCeMAn cc: pgsql-sql@postgresql.org Subject: Re: SIMILAR TO In-reply-to: References: Comments: In-reply-to Rommel the iCeMAn message dated "Sat, 16 Oct 2010 10:26:46 -0400" Date: Sat, 16 Oct 2010 10:30:14 -0400 Message-ID: <6862.1287239414@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/42 X-Sequence-Number: 34693 Rommel the iCeMAn 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