pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Dilger <mark.dilger@enterprisedb.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: " <David@calascibetta.com>
Cc: " <David@calascibetta.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17258: Unexpected results in CHAR(1) data type
Date: Fri, 29 Oct 2021 15:18:30 -0700
Message-ID: <B7220689-0307-46C5-A65D-3BD60DA364B4@enterprisedb.com> (raw)
In-Reply-To: <CAKFQuwbF9=HD+nBxYX4QfMEA68zSNz_OdUqpW-dQDDdotp08kg@mail.gmail.com>
References: <17258-a7c164c5fb955221@postgresql.org>
	<19D58355-E7C3-47D7-9C87-51EC751AE2BB@enterprisedb.com>
	<003701d7ccfb$c2a85bb0$47f91310$@calascibetta.com>
	<0EE9669C-6E65-40E1-B492-F989F452DAC4@enterprisedb.com>
	<005501d7cd0b$9ba5d5f0$d2f181d0$@calascibetta.com>
	<F04C22E4-C392-446E-840E-264F77397945@enterprisedb.com>
	<005901d7cd0f$500f1c10$f02d5430$@calascibetta.com>
	<B2408D10-D49A-4B9D-99C6-B695B86BF99B@enterprisedb.com>
	<CAKFQuwbF9=HD+nBxYX4QfMEA68zSNz_OdUqpW-dQDDdotp08kg@mail.gmail.com>



> On Oct 29, 2021, at 3:13 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
> 
> For practical purposes you will frequently hit the one bit or the other.  
> 
> 
> As I noted in a prior reply, octet_length(char) does the length computation with the padding spaces.  So it is possible for char input functions to do the expected thing.

Yes, I saw that.  But there aren't that many functions like octet_length that do so.  If users coming from other RDBMSs expect CHAR(1) to behave as David expects them to behave, it's cold comfort to say, "hang in there, you can still use octet_length() on them!"  Better to say that they are going to be bitten by this expectation again and again, and instead choose a different datatype (which you also said.)


—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company








view thread (19+ messages)  latest in thread

Message-ID: <B7220689-0307-46C5-A65D-3BD60DA364B4@enterprisedb.com>
Permalink:  ../B7220689-0307-46C5-A65D-3BD60DA364B4@enterprisedb.com/
Also on:    postgresql.org/message-id/B7220689-0307-46C5-A65D-3BD60DA364B4@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: mark.dilger@enterprisedb.com, david.g.johnston@gmail.com, David@calascibetta.com
  Subject: Re: BUG #17258: Unexpected results in CHAR(1) data type
  In-Reply-To: <B7220689-0307-46C5-A65D-3BD60DA364B4@enterprisedb.com>
  References: <17258-a7c164c5fb955221@postgresql.org> <19D58355-E7C3-47D7-9C87-51EC751AE2BB@enterprisedb.com> <003701d7ccfb$c2a85bb0$47f91310$@calascibetta.com> <0EE9669C-6E65-40E1-B492-F989F452DAC4@enterprisedb.com> <005501d7cd0b$9ba5d5f0$d2f181d0$@calascibetta.com> <F04C22E4-C392-446E-840E-264F77397945@enterprisedb.com> <005901d7cd0f$500f1c10$f02d5430$@calascibetta.com> <B2408D10-D49A-4B9D-99C6-B695B86BF99B@enterprisedb.com> <CAKFQuwbF9=HD+nBxYX4QfMEA68zSNz_OdUqpW-dQDDdotp08kg@mail.gmail.com> <B7220689-0307-46C5-A65D-3BD60DA364B4@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox