From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | character confusion |
Date: | 2010-03-05 17:36:11 |
Message-ID: | 4B91410B.3020807@pinpointresearch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Just noticed something odd with a column of type "char". According to
the docs (and the way my old PG ran), the character data-type is
blank-padded. I'm not seeing that on one of my current machines (8.3.8)
or, perhaps I'm going blind on Friday. Was the definition of char changed?
Here is what I am seeing:
steve=> create temporary table foo (bar char(10));
CREATE TABLE
steve=> \d foo
Table "pg_temp_2.foo"
Column | Type | Modifiers
--------+---------------+-----------
bar | character(10) |
steve=> insert into foo values ('');
INSERT 0 1
steve=> insert into foo values ('asd');
INSERT 0 1
steve=> insert into foo values ('asdfasdf');
INSERT 0 1
steve=> insert into foo values ('asdfasdfas');
INSERT 0 1
steve=> insert into foo values ('asdfasdfasd');
ERROR: value too long for type character(10)
steve=>=> select bar,length(bar),char_length(bar) from foo;
bar | length | char_length
------------+--------+-------------
| 0 | 0
asd | 3 | 3
asdfasdf | 8 | 8
asdfasdfas | 10 | 10
select bar,length(bar) from foo;
Cheers,
Steve
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2010-03-05 17:50:22 | Re: kernel version impact on PostgreSQL performance |
Previous Message | G Dutton | 2010-03-05 17:15:55 | log_statement and syslog severity |