Re: BUG #15069: group by after regexp_replace

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org, koglep(at)gmail(dot)com
Subject: Re: BUG #15069: group by after regexp_replace
Date: 2018-02-15 15:34:59
Message-ID: 87fu62qngv.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

>>>>> "PG" == PG Bug reporting form <noreply(at)postgresql(dot)org> writes:

PG> select upper(regexp_replace(a, '\\s+', '')) as keyword

This regexp doesn't do what you seem to be expecting. With
standard_conforming_strings enabled, which is the default, \ is not a
special character to the string literal parser, so the regexp engine is
seeing a regexp of \\s+ which means "match the literal character \
followed by one or more lowercase "s" characters". Accordingly the
regexp never matches on your input.

To remove whitespace use '\s+' or E'\\s+' or '[[:space:]]+'

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dan Goodliffe 2018-02-15 19:24:20 Re: BUG #15063: Updates to temporary tables fail when there is a publication with FOR ALL TABLES
Previous Message David G. Johnston 2018-02-15 15:25:12 Re: BUG #15069: group by after regexp_replace