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 1mgZx4-0001T6-Kv for pgsql-bugs@arkaria.postgresql.org; Fri, 29 Oct 2021 22:02:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mgZx2-0007wz-P8 for pgsql-bugs@arkaria.postgresql.org; Fri, 29 Oct 2021 22:02:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mgZOK-0008Ff-Vr for pgsql-bugs@lists.postgresql.org; Fri, 29 Oct 2021 21:26:25 +0000 Received: from mail158c38.carrierzone.com ([66.175.56.188] helo=mail170c38.carrierzone.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mgZOF-0007Se-Tl for pgsql-bugs@lists.postgresql.org; Fri, 29 Oct 2021 21:26:23 +0000 X-Authenticated-User: david@calascibetta.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=carrierzone.com; s=mailmia; t=1635542776; bh=FSeExm4T7w7aQe5Gz7ND5+X2RTC9H8NNgsbfeEy1ToU=; h=Reply-To:From:To:Cc:References:In-Reply-To:Subject:Date:From; b=LExuoDO+bfQPKrdNzHw56VJkVV33fvRX0/BD4VjN3RYji36IKQk1BZee5dcjrYOMh 1m4Qt/3rbBKQqtKkP2fmkxzFf6CTnIrci9Zqa9R9icisZtIiRZNooXT87TWEDJeo/Y T5AJfykNnMdC9gKHsBe5kn6ntIDJ983CVGrPk1qs= Feedback-ID: david@calascibe Received: from Workstation (99-16-240-20.lightspeed.mrgvil.sbcglobal.net [99.16.240.20]) (authenticated bits=0) by mail170c38.carrierzone.com (8.14.9/8.13.1) with ESMTP id 19TLQEPM016860; Fri, 29 Oct 2021 21:26:15 +0000 Reply-To: From: "David M. Calascibetta" To: "'Mark Dilger'" Cc: References: <17258-a7c164c5fb955221@postgresql.org> <19D58355-E7C3-47D7-9C87-51EC751AE2BB@enterprisedb.com> <003701d7ccfb$c2a85bb0$47f91310$@calascibetta.com> <0EE9669C-6E65-40E1-B492-F989F452DAC4@enterprisedb.com> In-Reply-To: <0EE9669C-6E65-40E1-B492-F989F452DAC4@enterprisedb.com> Subject: RE: BUG #17258: Unexpected results in CHAR(1) data type Date: Fri, 29 Oct 2021 16:26:15 -0500 Message-ID: <005501d7cd0b$9ba5d5f0$d2f181d0$@calascibetta.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQLB1uYWs1aJVPkX1BZhIF63SkMLgwH/iU5GAnFecvcC9n3sD6nbLbYQ Content-Language: en-us X-CTCH-RefID: str=0001.0A742F1E.617C66F8.0015:SCFSTAT57938998,ss=1,re=-4.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=JajfEWGV c=1 sm=1 tr=0 ts=617c66f8 a=4+o7z3fL63oxpBr+4DDEQg==:117 a=4+o7z3fL63oxpBr+4DDEQg==:17 a=IkcTkHD0fZMA:10 a=oa-xg8NNAAAA:8 a=pCOydsRIAAAA:8 a=epTmVMiNAAAA:8 a=LwCGxDq2yZEDp0YGJ0IA:9 a=QEXdDO2ut3YA:10 a=MQ1BrC-N35uif390zSTS:22 a=4YKM6X3TZtkG47b_JkB7:22 a=ndEWmUVY6Yapc0oHF_P4:22 X-Origin-Country: US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk OK. I have a work-around so I'm alright. I agree, the behavior is nuts, and is inconsistent with every other = RDBMS out there. I was only reporting it to improve the product, but if you think this is = appropriate behavior, I'm good with it. You can close this issue. David -----Original Message----- From: Mark Dilger =20 Sent: Friday, October 29, 2021 4:16 PM To: Cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17258: Unexpected results in CHAR(1) data type > On Oct 29, 2021, at 12:32 PM, David M. Calascibetta = wrote: >=20 > Ok, but my example was just a simplified version of what is going on. > The actual problem stems from a CHAR(1) column data type that is = behaving the same way. > I was just trying to create a super-simple example of the problem. > It still seems to me that a CHAR(1) should never be zero length, = regardless of how it's implemented. Please consider: mark.dilger=3D# select ''::char(1) =3D ' '::char(50); ?column?=20 ---------- t (1 row) I infer that you expect a single byte of space to be compared against 50 = bytes of space, and to be found unequal. Postgres doesn't treat = trailing spaces in char(n) the way I infer that you expect. Even = without casting to another type (and the equality operator for char(n) = does not cast to another type) the comparison logic intentionally = ignores the trailing spaces. Consider also: mark.dilger=3D# select length(' '::char(50)); length -------- 0 (1 row) Perhaps this behavior is nuts, but I say it is not a bug, just a = peculiarity in how char(n) is defined to behave.=20 =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL = Company