Re: SIMILAR TO bug?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SIMILAR TO bug?
Date: 2009-02-18 15:45:59
Message-ID: 499C2D37.80700@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter wrote:
> Folks,
>
> Perhaps I've misunderstood this, but in PostgreSQL 8.3.5, I get
> disparate results from ~ and SIMILAR TO. For example:
>
> This gives an unexpected result:
>
> davidfetter(at)davidfetter=# SELECT 'abc' SIMILAR TO '^[a]';
> ?column?
> ----------
> f
> (1 row)
>
> This one is what I expected.
>
> davidfetter(at)davidfetter=# SELECT 'abc' ~ '^[a]';
> ?column?
> ----------
> t
> (1 row)
>
> Did I misunderstand what SIMILAR TO does, or...?

Well, SIMILAR TO is not the same thing as ~. For example, ^ is not a
special character in its pattern language.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-02-18 15:47:25 Re: pg_migrator progress
Previous Message Gregory Stark 2009-02-18 15:39:10 Re: pg_migrator progress