Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fnJo8-0005qA-9g for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Aug 2018 08:27:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fnJo6-0002hi-5o for pgsql-bugs@arkaria.postgresql.org; Wed, 08 Aug 2018 08:27:02 +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.89) (envelope-from ) id 1fnJo5-0002hW-SM for pgsql-bugs@lists.postgresql.org; Wed, 08 Aug 2018 08:27:02 +0000 Received: from mail-lj1-f193.google.com ([209.85.208.193]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fnJo1-0005LA-Cu for pgsql-bugs@lists.postgresql.org; Wed, 08 Aug 2018 08:27:00 +0000 Received: by mail-lj1-f193.google.com with SMTP id 203-v6so1022127ljj.13 for ; Wed, 08 Aug 2018 01:26:56 -0700 (PDT) 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-language :content-transfer-encoding; bh=Gc9LA8Z3XVBHuZFZQRbBrKJ5HDDp8z7fMGFlGghq0+U=; b=QPo+VxULs55P0NSHVygXFGA+30mgKqPK/2UzJuLDT1tQ2/dd9GsWk/lzhUk91EDa/V SogLn3nurQRGfiPExdStpPGRAyKqTa7chLVI1M6bGT+sYRLQB7JOjk5fiBEkisWY/4QC yCCD+AslGyC39I34eb0KcUTt3yvE8QRzSnEXb3I23TmtOMqNJ1g9BuZZsJfxQQVTgElW iJZm7HOQsbS9v7Tzlytnp217QPMLtKOOx+ZFpHa2vC5Amos7aY4xozw/m2gXjHT7AHES 6YT+Bk54am5quJ+U7f6fhpluGEfxqdIygCbnHeZ8IdB3BB7Q+bM1nWz1OVgsmkgGuo9A Lp4Q== X-Gm-Message-State: AOUpUlFudMND5i9yL6uwvuzbaUUXnlurv4RlE7AzKdz2LscxmzuFrNZ2 1oJI17NFnNkgG7xQ2XQ1wpo= X-Google-Smtp-Source: AA+uWPytGPSP97OoLeUhF5w3ergNg/D3giojUZi/jiPesYJbaL5S4dXmKX9d6awRFARntRJ84Ctlfw== X-Received: by 2002:a2e:4357:: with SMTP id q84-v6mr1279213lja.13.1533716815122; Wed, 08 Aug 2018 01:26:55 -0700 (PDT) Received: from [192.168.1.11] (dsl-hkibng32-54fbf8-78.dhcp.inet.fi. [84.251.248.78]) by smtp.gmail.com with ESMTPSA id x65-v6sm708520lfb.60.2018.08.08.01.26.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 01:26:54 -0700 (PDT) Subject: Re: BUG #15317: Sort order error To: pahwa.sumit@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form References: <153371119378.1298.16323419052428888575@wrigleys.postgresql.org> From: Heikki Linnakangas Message-ID: <7039133c-fe5b-4036-cba1-c66f24b2c607@iki.fi> Date: Wed, 8 Aug 2018 11:26:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <153371119378.1298.16323419052428888575@wrigleys.postgresql.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 08/08/18 09:53, PG Bug reporting form wrote: > When I execute a query > select 'ALEX DARGAY' > 'ALEXANDER'; > It should return false as output because ascii value of space is lower than > ascii value of 'A'. > But the output is true, which is incorrect. The correct answer to that query depends on the current locale. You seem to be assuming that POSIX / C locale is used. You can check the current locale's collation order with "show lc_collate;". The locale support is provided by the Operating System, so even if the locale is nominally the same, e.g. "UK English", it might behave slightly differently on different systems. See the user manual, sections 23.1 Locale Support and 23.2 Collation Support for more information: https://www.postgresql.org/docs/10/static/locale.html https://www.postgresql.org/docs/10/static/collation.html - Heikki