pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Dilger <mark.dilger@enterprisedb.com>
To: " <David@calascibetta.com>
To: " <David@Calascibetta.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17258: Unexpected results in CHAR(1) data type
Date: Fri, 29 Oct 2021 14:36:08 -0700
Message-ID: <F04C22E4-C392-446E-840E-264F77397945@enterprisedb.com> (raw)
In-Reply-To: <005501d7cd0b$9ba5d5f0$d2f181d0$@calascibetta.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>



> On Oct 29, 2021, at 2:26 PM, David M. Calascibetta <david@calascibetta.com> wrote:
> 
> OK. I have a work-around so I'm alright.

Glad to hear it.

> I agree, the behavior is nuts, and is inconsistent with every other RDBMS out there.

I haven't studied the behavior of char(n) on other RDBMS products.  I'd be curious if the SQL spec says anything that we're violating in this regard.  If so, we should at least have a warning in the docs about that.  (We already have a warning about how char(n) behaves, but nothing I see about the behavior being non-compliant.)  But I'm wondering if other RDBMS products really differ in this regard?  Are you perhaps thinking about how varchar(n) works? 

> I was only reporting it to improve the product, but if you think this is appropriate behavior,
> I'm good with it.

I tend to think of char(n) as a misfeature and avoid using it.  Based on your experience with other RDBMSs, would you expect char(n) and varchar(n) to behave the same or to behave differently?  In postgres, they are different, and varchar(n) would behave more like you seem to want.

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








view thread (19+ messages)  latest in thread

Message-ID: <F04C22E4-C392-446E-840E-264F77397945@enterprisedb.com>
Permalink:  ../F04C22E4-C392-446E-840E-264F77397945@enterprisedb.com/
Also on:    postgresql.org/message-id/F04C22E4-C392-446E-840E-264F77397945@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@calascibetta.com
  Subject: Re: BUG #17258: Unexpected results in CHAR(1) data type
  In-Reply-To: <F04C22E4-C392-446E-840E-264F77397945@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>

* 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