Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8fQ4-0004my-Uo for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2019 06:51:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i8fQ3-0007V8-Qd for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2019 06:50:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8fOH-0002hs-SH for pgsql-general@lists.postgresql.org; Fri, 13 Sep 2019 06:49:10 +0000 Received: from smh-06.1blu.de ([178.254.0.206]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i8fOD-0005dG-Q4 for pgsql-general@lists.postgresql.org; Fri, 13 Sep 2019 06:49:08 +0000 Received: from [172.16.29.5] (helo=sh4-5.1blu.de) by smh-06.1blu.de with esmtp (Exim 4.86_2) (envelope-from ) id 1i8fO7-0005qa-L3; Fri, 13 Sep 2019 08:48:59 +0200 Received: from ftp51246-2575596 by sh4-5.1blu.de with local (Exim 4.86_2) (envelope-from ) id 1i8fO7-0014BJ-Jg; Fri, 13 Sep 2019 08:48:59 +0200 Date: Fri, 13 Sep 2019 08:48:59 +0200 From: Matthias Apitz To: Pavel Stehule Cc: pgsql-general Subject: Re: PG SQL and LIKE clause Message-ID: <20190913064859.GA252643@sh4-5.1blu.de> Reply-To: Matthias Apitz References: <20190913052846.GA3070@c720-r342378> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk El día Friday, September 13, 2019 a las 07:33:10AM +0200, Pavel Stehule escribió: > > We got to know that in CHAR columns with trailing blanks a > > > > SELECT ... FROM ... WHERE name LIKE 'Ali' > > > > does not match in 'name' having 'Ali '. > > > > I glanced through our code with grep pipelines and found some hundred > > places which would be affected by this problem. I'm not interested in a > > religious discussion if or if not this behaviour of PG is correcter or > > better than in Sybase. It's just different to Sybase. > > > > Any hints to address this problem? Or is there any compile time option > > for the PG server to address this? > > > > There is not simple solution - you should to write own patch and used > patched postgres. Hello, As we compiled our own PG 11.4 and as we're alone on the server with our software plus PG, this could be an option to consider. Do you have an idea where to look for this in the PG source. Maybe it's just deleting the trailing blanks from the column content before applying the string compare with regular expressions. Thanks matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!