Re: Significant trailing spaces - Mailing list pgsql-novice

From Steve Tucknott
Subject Re: Significant trailing spaces
Date
Msg-id 1091515441.1119.6.camel@retsol1
Whole thread Raw
In response to Re: Significant trailing spaces  (mike g <mike@thegodshalls.com>)
List pgsql-novice
Mike,
This is from the 7.4 release notes - in my install the file is called HISTORY and is located directly under the postgre directory (not to be confused with the other history file that gives the BERKELEY background info)

.....
     * Trailing spaces are now trimmed when converting from type char(n)
       to varchar(n) or text. This is what most people always expected to
       happen anyway.
...

The passage is at line 372, under the 'Migration to version 7.4' heading.


On Tue, 2004-08-03 at 04:47, mike g wrote:
The only thing I see mentioned in the docs is that prior to 7.2:

insert char( 250 ) into a column of char ( 100 ) would succeed without
generating an error or warning that 150 characters were chopped off.

In 7.2: insert char( 250 ) into a column of char ( 100 ) crashes with an
error.

        insert char (250) into a CAST(column as char (100)) succeeds and
silently chops off the last 150 characters.

The 150 characters chopped could be any type of character data (trailing
space etc.).

I am looking at
http://www.postgresql.org/docs/7.4/static/datatype-character.html.

If you are looking at something different please post a link or copy and
paste if it is not long.

Mike

On Mon, 2004-08-02 at 09:08, Steve Tucknott wrote:
> PostGreSql 7.4.3 
> 
> I noticed that there was a change in the way that 7.4 handled trailing
> spaces in CHAR/VARCHARS, 
> so upgraded from 7.2.4, 
> I still seem to get the same problem - putting a CHAR(250) variable
> (with trailing spaces) into a VARCHAR(100) gives me a VARCHAR with a
> length 100 - ie padded with spaces. Is this still correct? 
> 
> Have I misunderstood, and are trailing spaces handled in the same way
> in both 7.2.4 and 7.4.3 (or is there some flag I need to set to get
> the new functionality?) 
> 
> 
> Regards,
> 
> Steve Tucknott
> 
> ReTSol Ltd
> 
> DDI: 01903 828769


Regards,

Steve Tucknott

ReTSol Ltd

DDI: 01903 828769

pgsql-novice by date:

Previous
From: mike g
Date:
Subject: Re: Significant trailing spaces
Next
From: Gaetano Mendola
Date:
Subject: Re: Comparing database schema's