Skip site navigation (1) Skip section navigation (2)

Re: CHAR(n) always trims trailing spaces in 7.4

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "news(dot)postgresql(dot)org" <jlim(at)natsoft(dot)com(dot)my>
Cc: pgsql-sql(at)postgresql(dot)org, elein <elein(at)varlena(dot)com>
Subject: Re: CHAR(n) always trims trailing spaces in 7.4
Date: 2004-02-17 23:10:56
Message-ID: 18611.1077059456@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-sql
"news.postgresql.org" <jlim(at)natsoft(dot)com(dot)my> writes:
> I just discovered the following change to CHAR(n) (taken from varlena.com,
> general bits, issue 62).

The description you quote doesn't appear to have much of anything to do
with the actual behavior of 7.4.

7.4 will trim trailing spaces when converting char(n) to varchar or
text, but the example query does not do that.  It just coerces query
output columns to char(n), and that works the same as it did before.
For instance

regression=# select 'zit'::char(77);
                                    bpchar
-------------------------------------------------------------------------------
 zit
(1 row)


			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: eleinDate: 2004-02-17 23:17:28
Subject: Re: CHAR(n) always trims trailing spaces in 7.4
Previous:From: Simon RiggsDate: 2004-02-17 22:41:17
Subject: Archival API

pgsql-sql by date

Next:From: eleinDate: 2004-02-17 23:17:28
Subject: Re: CHAR(n) always trims trailing spaces in 7.4
Previous:From: scott.marloweDate: 2004-02-17 22:46:52
Subject: Re: Function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group