Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emLlP-0005Jp-L6 for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Feb 2018 15:47:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emLlO-0002yP-Sy for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Feb 2018 15:47:58 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1emLkB-0005by-5A for pgsql-bugs@lists.postgresql.org; Thu, 15 Feb 2018 15:46:43 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emLZ6-0001xW-Ah for pgsql-bugs@lists.postgresql.org; Thu, 15 Feb 2018 15:35:34 +0000 Received: from [192.168.127.1] (port=55429 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1emLYs-000241-19; Thu, 15 Feb 2018 15:35:02 +0000 Received: from [127.0.0.1] (port=19417 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1emLYr-0003wi-4g; Thu, 15 Feb 2018 15:35:01 +0000 From: Andrew Gierth To: pgsql-bugs@lists.postgresql.org, koglep@gmail.com Subject: Re: BUG #15069: group by after regexp_replace In-Reply-To: <151870768979.1393.4103488163602755553@wrigleys.postgresql.org> (PG Bug reporting form's message of "Thu, 15 Feb 2018 15:14:49 +0000") Message-ID: <87fu62qngv.fsf@news-spur.riddles.org.uk> References: <151870768979.1393.4103488163602755553@wrigleys.postgresql.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Thu, 15 Feb 2018 15:34:59 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "PG" == PG Bug reporting form 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)