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 1epKJm-0000RD-Az for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Feb 2018 20:51:46 +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 1epKJl-00072Y-8j for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Feb 2018 20:51:45 +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 1epKJk-00072P-Vt for pgsql-bugs@lists.postgresql.org; Fri, 23 Feb 2018 20:51:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1epKJi-00024M-JP for pgsql-bugs@lists.postgresql.org; Fri, 23 Feb 2018 20:51:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w1NKpfom023732; Fri, 23 Feb 2018 15:51:41 -0500 From: Tom Lane To: tudorb@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15084: Invalid LIKE pattern not always reported In-reply-to: <151941775547.1463.3686411361406861190@wrigleys.postgresql.org> References: <151941775547.1463.3686411361406861190@wrigleys.postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Fri, 23 Feb 2018 20:29:15 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23730.1519419101.1@sss.pgh.pa.us> Date: Fri, 23 Feb 2018 15:51:41 -0500 Message-ID: <23731.1519419101@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?utf-8?q?PG_Bug_reporting_form?= writes: > PostgreSQL will not always detect an invalid LIKE pattern (one that ends > with a backslash). > This probably happens because the pattern is only parsed lazily (as needed); > if PostgreSQL detects that a match is impossible, it doesn't even look at > the rest of the pattern. Yeah, exactly. > Still, it would be nice for error reporting to be consistent. This has been discussed before, but nobody could see how to do it without taking a performance hit (ie, doing a full scan of the pattern before doing any actual work). It didn't seem worth that. It occurs to me that we could make the behavior more consistent by redefining a trailing backslash as something we silently ignore, instead of raising an error. Not sure if that's an improvement, though. regards, tom lane