From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | char() datatype looses strings of all spaces |
Date: | 2003-08-17 05:07:23 |
Message-ID: | 3F3F0D8B.4060802@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I stumbled across this behavior today and it seems strange if not a bug:
-- this seems wrong
vsconf=# create table foo (f1 char(1));
CREATE TABLE
vsconf=# insert into foo values(' ');
INSERT 9002011 1
vsconf=# select ascii(f1) from foo;
ascii
-------
0
(1 row)
-- this is what I'd expect
vsconf=# create table foo2 (f1 varchar(1));
CREATE TABLE
vsconf=# insert into foo2 values(' ');
INSERT 9002015 1
vsconf=# select ascii(f1) from foo2;
ascii
-------
32
(1 row)
-- this seems wrong
vsconf=# create table foo4 (f1 char(5));
CREATE TABLE
vsconf=# insert into foo4 values(' ');
INSERT 9002022 1
vsconf=# select ascii(f1) from foo4;
ascii
-------
0
(1 row)
I looked for a few minutes at bpcharin(), but could not see exactly why
this is happening. Am I missing something wrt the char() data type, or
is this a bug?
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-08-17 05:08:12 | Re: Question with hashed IN |
Previous Message | Bruce Momjian | 2003-08-17 05:00:01 | Re: Parsing speed (was Re: pgstats_initstats() cost) |