Re: SIMILAR TO bug? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: SIMILAR TO bug?
Date
Msg-id 499C2D37.80700@gmx.net
Whole thread Raw
In response to SIMILAR TO bug?  (David Fetter <david@fetter.org>)
List 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@davidfetter=# SELECT 'abc' SIMILAR TO '^[a]';
>  ?column? 
> ----------
>  f
> (1 row)
> 
> This one is what I expected.
> 
> davidfetter@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.


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: SIMILAR TO bug?
Next
From: Tom Lane
Date:
Subject: Re: pg_migrator progress