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.92) (envelope-from ) id 1jIDus-00050L-3V for pgsql-novice@arkaria.postgresql.org; Sat, 28 Mar 2020 16:02:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jIDuq-0007hG-4y for pgsql-novice@arkaria.postgresql.org; Sat, 28 Mar 2020 16:02:32 +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 1jIDup-0007gn-Nb for pgsql-novice@lists.postgresql.org; Sat, 28 Mar 2020 16:02:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIDun-0000bq-Gi for pgsql-novice@postgresql.org; Sat, 28 Mar 2020 16:02:30 +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 02SG2QYB005569; Sat, 28 Mar 2020 12:02:26 -0400 From: Tom Lane To: "David G. Johnston" cc: =?UTF-8?Q?gmail_Vladimir_Kokovi=C4=87?= , pgsql-novice , Ken Benson Subject: Re: chr(3) and 3::text In-reply-to: References: <769c6f0f-62e1-bd7d-b3bc-221619ab4680@gmail.com> Comments: In-reply-to "David G. Johnston" message dated "Sat, 28 Mar 2020 08:25:52 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <5567.1585411346.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sat, 28 Mar 2020 12:02:26 -0400 Message-ID: <5568.1585411346@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > On Sat, Mar 28, 2020 at 8:09 AM gmail Vladimir Koković < > vladimir.kokovic@gmail.com> wrote: >> Main question is, why is 3::text == '3' ? > Its that way because :: is defined to make it that way. More concretely: for most types, casting to text is defined to produce the textual representation of the value. An unadorned literal 3 starts life as type integer, so what you've got here is an integer-to-text cast, and that's going to convert the integer the same way it would be output. regards, tom lane