From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | b(dot)wood(at)niwa(dot)co(dot)nz |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #11875: char() not behaving as documented |
Date: | 2014-11-04 20:36:09 |
Message-ID: | 15515.1415133369@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
b(dot)wood(at)niwa(dot)co(dot)nz writes:
> According to the docs
> http://www.postgresql.org/docs/9.3/static/datatype-character.html)(:
> " If the string to be stored is shorter than the declared length, values of
> type character will be space-padded; values of type character varying will
> simply store the shorter string."
Quite.
> Yet chars are not being padded
Yes they are. You are neglecting the fact that a coercion from char to
varchar/text strips trailing blanks, so that a test like this:
> fish=# select var3||':' as var3, cha3||':' as char3 from test;
proves nothing at all about how many trailing spaces there were in
cha3.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-11-04 21:40:14 | Re: PostgreSQL 9.3 Segfault in "hstore_to_json" function |
Previous Message | Andres Freund | 2014-11-04 20:03:28 | Re: [BUGS] [HACKERS] COPY TO returning empty result with parallel ALTER TABLE |