Re: BUG #17258: Unexpected results in CHAR(1) data type

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: "<David(at)calascibetta(dot)com>" <David(at)Calascibetta(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17258: Unexpected results in CHAR(1) data type
Date: 2021-10-29 21:36:08
Message-ID: F04C22E4-C392-446E-840E-264F77397945@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Oct 29, 2021, at 2:26 PM, David M. Calascibetta <david(at)calascibetta(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2021-10-29 21:47:32 Re: BUG #17245: Index corruption involving deduplicated entries
Previous Message Andres Freund 2021-10-29 21:30:48 Re: BUG #17245: Index corruption involving deduplicated entries