Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMEWv-0006W2-Gz for pgsql-general@arkaria.postgresql.org; Wed, 08 Apr 2020 17:30:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jMEWu-0008Kx-CP for pgsql-general@arkaria.postgresql.org; Wed, 08 Apr 2020 17:30:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMDG1-0000gh-Jt for pgsql-general@lists.postgresql.org; Wed, 08 Apr 2020 16:08:53 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMDFz-0000xc-AN for pgsql-general@postgresql.org; Wed, 08 Apr 2020 16:08:52 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id C85406DD; Wed, 8 Apr 2020 12:08:49 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute7.internal (MEProxy); Wed, 08 Apr 2020 12:08:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=t/jrDA syNdgL1LoehISPxHForHuqccLx68yU0GX3Kxw=; b=XaGnFfAAKjPUs+VNYAJK4w KgMo33BlbeT1OKmLybZ4Gl4rl68gp5k23lHav1Cuf7IUR+Vfoh3VPnLJUAPagwpn 8V1vGmYZ9ONMzzvvkQ+pMztNJe/be093lhHLoMT9B/zTLuKZTimRk4vGNMcviHqU lQNjAeA7m9T8zT8uTcmwbZSEDnZ9yWxVzjbZzk2obBpXXDXir1MfaWJ5F+VC1OYa 1r3lua5tOq+baduS1AzyNWFec6v7su5oIj3C4ORM/vcTUX8WzZPmvgGqGdKifhwn Wh84D/vZSPzfSCCkQvlh8VuisGxhT7sGdF3K5i/39pLLpQDs+TGFgjTIOfsjfk9A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedflfhimhhm hicuvfhhrhgrshhhvghrfdcuoehjihhmmhihsehjihhmmhihthhhrhgrshhhvghrrdgtoh hmqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhimhhmhiesjhhimhhmhihthh hrrghshhgvrhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id D5C5166007E; Wed, 8 Apr 2020 12:08:48 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-1104-g203475c-fmstable-20200408v2 Mime-Version: 1.0 Message-Id: <3774568d-8ac8-4f02-95af-7bd78a23b15c@www.fastmail.com> In-Reply-To: References: <410dddd6-bc66-48ca-ab9d-13889d94b62c@www.fastmail.com> Date: Wed, 08 Apr 2020 12:08:27 -0400 From: "Jimmy Thrasher" To: "Adrian Klaver" , pgsql-general@postgresql.org Subject: Re: Unexpected behavior sorting strings Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Many thanks! That clarifies things well. Jimmy On Wed, Apr 8, 2020, at 11:49 AM, Adrian Klaver wrote: > On 4/8/20 7:35 AM, Jimmy Thrasher wrote: > > Am I missing something about how sorting works? > > I believe you are looking for 'C' collation: > > test=# select unnest(array[('> N' collate "C") , ('< S' COLLATE "C")]) > as s order by s; > > s > ----- > < S > > N > (2 rows) > > > For more information see: > > https://www.postgresql.org/docs/12/collation.html