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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: david(at)calascibetta(dot)com
Subject: BUG #17258: Unexpected results in CHAR(1) data type
Date: 2021-10-29 18:14:56
Message-ID: 17258-a7c164c5fb955221@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 17258
Logged by: David Calascibetta
Email address: david(at)calascibetta(dot)com
PostgreSQL version: 12.8
Operating system: AWS RDS
Description:

My understanding is that a CHAR(1) column can never be 0 (zero) length.
I expect the results of these two SELECT statements to produce the same
result:

select length(substr(' '::varchar,1,1)), ascii(substr('
'::varchar,1,1));
produces==> 1 32 (as expected)

select length(substr(' '::char,1,1)), ascii(substr(' '::char,1,1));
produces==> 0 0 (not as expected)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2021-10-29 18:17:19 Re: BUG #17257: (auto)vacuum hangs within lazy_scan_prune()
Previous Message David G. Johnston 2021-10-29 15:55:06 Re: BUG #17256: Running pgagent on a custom user