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 1q9pLG-0003Nj-SO for pgsql-admin@arkaria.postgresql.org; Thu, 15 Jun 2023 15:56:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q9pLF-00041z-Po for pgsql-admin@arkaria.postgresql.org; Thu, 15 Jun 2023 15:56:57 +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 1q9pLF-00041m-8B for pgsql-admin@lists.postgresql.org; Thu, 15 Jun 2023 15:56:57 +0000 Received: from mailout.easymail.ca ([64.68.200.34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q9pLB-002ND5-LI for pgsql-admin@lists.postgresql.org; Thu, 15 Jun 2023 15:56:55 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 6709FE119A; Thu, 15 Jun 2023 15:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=elevated-dev.com; s=easymail; t=1686844609; bh=fz6BDIL59OZ7LRD+yqheaYdgMNwfz1eh9XyQS0E6ix0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=UK+S7mlRyHyDSUvxxyxx//Ykk4iMff6RuKOcdEQDRJY3fpZa7/0k2OaA8yiWHib51 axPMXnhJTiuCMFwehIUVteBC/mMvWr8gdvLqUouaampe6R/WivjsliqcAbd+c8nVgF wV6Mvp1jiNrmDaMrYM10JBheBQCE5NlmrLyJ1RIjzhLnZALqzKy+IvcrY+rN20z1Vz 7u3jqZ72p46iruHMTIqd79Q5BmGBalhz4X55roa2kOfm9Z1DpOagWDB2eM1s3W6qt0 qcsqmjuArONTXYMXCF9bAkEGOn0xX9lD9Y2wHaiNS9ztnOCNxf5RUS9mnkhWb5K05S 3QoIABrvdvUKg== X-Virus-Scanned: Debian amavisd-new at emo08-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo08-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kBRBFtGP7_rS; Thu, 15 Jun 2023 15:56:49 +0000 (UTC) Received: from smtpclient.apple (unknown [165.140.184.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 97531E0EED; Thu, 15 Jun 2023 15:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=elevated-dev.com; s=easymail; t=1686844608; bh=fz6BDIL59OZ7LRD+yqheaYdgMNwfz1eh9XyQS0E6ix0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=03RuxsPR6Io0aFVwCdru3at16PMnW/JGRjKqEMusy3VQ3+x4bCMhm7fcbEEV2Y+Xu N6z0abIpx5wMy0RYaPXDPuX2562mDO4lUtSKq4ePaXj1qrwGp4XHTgL+zfMqQ8gQia rFExCq+V2SnWSUGSlmYO8oMaiomgOit94rd9NYJOtylN+mnomPcii5dfWpR99wmXNB WYHgzMhmBzJeBfgaAEtHXZ0mmgG/+jy5K76zy4jKaLPKb6dzpem6AT7JPs2L+P+phe Gr71O2/qr1gVGSHZA+UyjnXURPUPArpWZWYdz4z0qb2HvrrzJLbaG1cLPmC7Q48cEu HRgBW6FgFRsCw== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: The same result for with SPACE and without SPACE From: Scott Ribe In-Reply-To: <3f21240f59a54f96898886f2c9189cf3@express-scripts.com> Date: Thu, 15 Jun 2023 09:56:37 -0600 Cc: mahesh , Mohammed Aslam , "pgsql-admin@lists.postgresql.org" , Tom Lane , M Sarwar Content-Transfer-Encoding: quoted-printable Message-Id: References: <2018059.1686782739@sss.pgh.pa.us> <0055148e2cc742cbbc23485ae0c6c04e@express-scripts.com> <2CAFD37D-68FC-4A01-BE65-FAF1ADF7A60A@elevated-dev.com> <1726236757.407336.1686838293703@mail.yahoo.com> <3f21240f59a54f96898886f2c9189cf3@express-scripts.com> To: "Wetmore, Matthew (CTR)" X-Mailer: Apple Mail (2.3731.600.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Nobody's kicking you out of any group. Someone requested themselves to = be removed, with a typo that made it ambiguous. The original question had nothing to do with INT, it was behavior of = CHAR and trailing spaces. > select c1 from matt_test where c1 =3D '123' > -- all 3 rows returned. > Is it expected behavior that all 3 rows would be returned (because = the space isn=E2=80=99t an INT?) Yes. Or more precisely, it is because when a string is cast to an int, = leading and trailing spaces are ignored. The alternative would be to = raise an error, as 'an integer plus some spaces' is not an integer... > select c2 from matt_test2 where c2 =3D '123' > -- 1 rows returned. Yes, for TEXT column, which behaves the same as VARCHAR. Also 1 row for: select c2 from matt_test2 where c2 =3D '123 ' But 2 rows returned for CHAR column, as inserting '123' and '123 ' into = CHAR(n) results in the same value being inserted. And also 2 rows = returned for: select c2 from matt_test2 where c2 =3D '123 ' ^^^ which was the original question=