pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: its+postgres@csuhta.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14349: Parse failure (?) when LIKE swapped out for ~~
Date: Mon, 03 Oct 2016 06:09:24 +0000
Message-ID: <20161003060924.27236.38178@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14349
Logged by:          Corey Csuhta
Email address:      its+postgres@csuhta.com
PostgreSQL version: 9.5.4
Operating system:   macOS
Description:        

Here's this query:

SELECT 1 WHERE lower('ARTIST') LIKE '%'||'art'||'%'; 
Which selects:
1

But if you exchange ~~ for the LIKE statement here, Postgres does not
process it the same way:

SELECT 1 WHERE lower('ARTIST') ~~ '%'||'art'||'%'; 
Returns the error:
argument of WHERE must be type boolean, not type text
LINE 1: SELECT 1 WHERE lower('ARTIST') ~~ '%'||'art'||'%'

Is this expected? The documentation implies you can swap these operators and
get the same results.

I believe I have a minimum example above, the swap works if you do not use
|| or if you wrap the left and right side of the expression in parenthesis
to help the parser.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


view thread (2+ messages)  latest in thread

Message-ID: <20161003060924.27236.38178@wrigleys.postgresql.org>
Permalink:  ../20161003060924.27236.38178@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20161003060924.27236.38178@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: its+postgres@csuhta.com
  Subject: Re: BUG #14349: Parse failure (?) when LIKE swapped out for ~~
  In-Reply-To: <20161003060924.27236.38178@wrigleys.postgresql.org>
  References: <20161003060924.27236.38178@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox