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 1i8fhD-0005PG-Iw for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2019 07:08:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i8fhC-0005Zb-8Z for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2019 07:08:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8fhB-0005ZF-RL for pgsql-general@lists.postgresql.org; Fri, 13 Sep 2019 07:08:41 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8fh9-00078U-Lw for pgsql-general@lists.postgresql.org; Fri, 13 Sep 2019 07:08:41 +0000 Received: by mail-ot1-x330.google.com with SMTP id c10so28505493otd.9 for ; Fri, 13 Sep 2019 00:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=7B6Kcshvqq669SFk1ZPJqFi755b4q/dMqL/N3ol2HHk=; b=uTLeV1bsIX6xMtTeSwBOKDbkrKrgdcSfdYQfdIdXY8l2rkGQF2X3tsLRQiHi0eA14R x3954y14ka108nGKXqVhOvONx8dvi1eqMzJOHAtCZBN1g4RBdOeDy0IKnhwUnujYPACK c1d0QD9PNKjMhz/s2Swo8Rxu/+y7kGI2poOhDL0A1VeKP9H9sZZqXbOPhQd6nmaMzRS/ ZbJ7V8QUdEkOWxvVQt/b3MoGHW0yGA/TFMQHDZAHxE4QyMXVa5YJDkWbpvW3DMfddG3e 71y4hG7D+j6cgWO5Uf4og6+0kTk0b95DpxIzdMJqNiObaJyvaXpLEkY08nQAblBPNC6w jF1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=7B6Kcshvqq669SFk1ZPJqFi755b4q/dMqL/N3ol2HHk=; b=lHpRyyQQ3pfTjQ/kKQP/L9HI1E9uR1H0aiWx/GABgEJ9/OBTmatjOpb0fHLPmar+WK eIh2XS8Ws7izi9BQpjw6sHInbPqlfaq7EegPhw59mYwTALV+S1CzmzyDlyt0IAwII8B4 yZH94K/F8sD7OIDSqkYkCnP7hQHJ+b1S+jJ3klQVHS/v3qsQdamDSWr7Cz/AdowDyz59 18W9rrs4oVsvIOdzp0t7UCMsbFNYxQOixLCAVDDRGzVKZv+hETn/RRvqrFSSleUZvcdu Iqes8NBOqrqIvpTGczOezF3dQhpHFkrWGNL/pcsKSyUhVz72i+DeAufb0emvi5EHbn5H A8Cw== X-Gm-Message-State: APjAAAWyr9HyQNA8lfbQv8byHahcrm408FTo6knjEEacMnX8DuS+NUCx ott0ctkAK8HyASppLzPTmPo4ydMc6P80og== X-Google-Smtp-Source: APXvYqx3Jlxuyuy7ZKRePziIjs2mGMj0CBRrA645h9iZVEA5Cz3zEq6asdG7DLmbHtluvr+/VrVQ2Q== X-Received: by 2002:a9d:62c4:: with SMTP id z4mr36773064otk.305.1568355118460; Thu, 12 Sep 2019 23:11:58 -0700 (PDT) Received: from [192.168.1.10] (ip70-186-126-197.no.no.cox.net. [70.186.126.197]) by smtp.googlemail.com with ESMTPSA id t8sm490167oic.46.2019.09.12.23.11.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Sep 2019 23:11:57 -0700 (PDT) Subject: Re: PG SQL and LIKE clause To: pgsql-general@lists.postgresql.org References: <20190913052846.GA3070@c720-r342378> From: Ron Message-ID: Date: Fri, 13 Sep 2019 01:11:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190913052846.GA3070@c720-r342378> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/13/19 12:28 AM, Matthias Apitz wrote: > Hello, > > We're porting a huge Library Management System, written using all kind > of languages one can think of (C, C++, ESQL/C, Perl, Java, ...) on Linux > from the DBS Sybase to PG, millions of lines of code, which works also > with DBS Oracle and in the past with INFORMIX-SE and -ONLINE. > > 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 '. Did you forget the "%"?  Because the SQL standard which PostgreSQL follows is: SELECT ... FROM ... WHERE name LIKE '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. SQL Server derives from Sybase, and it would also fail on this statement. > Any hints to address this problem? Or is there any compile time option > for the PG server to address this? > > Thanks > > matthias -- Angular momentum makes the world go 'round.