Re: [dabo-users] PostgreSQL char fields are rpadded

Author: Dennis Lee Bieber

Posted: 2011-11-17 at 23:34:22

On Thu, 17 Nov 2011 15:37:26 -0800, Paul McNett <p@ulmcnett.com>

declaimed the following in gmane.comp.python.dabo.user:

> On 11/17/11 3:26 PM, Paul McNett wrote:

> > I must be overlooking something exceedingly obvious, or I'd have seen this issue

> > discussed before. Right?

>

> I guess I need to convert those char(n) to varchar(n) fields and it'll be okay. I

> guess postgres probably made the correct decision to not implicitly strip those

> characters.

>

One could argue both ways -- MySQL implicitly strips trailing spaces

on retrieval, just as it implicitly pads CHAR types with trailing spaces

to fill the field on store. PostgreSQL is implicitly padding CHAR on

input, and not stripping on retrieval. I'd probably prefer MySQL's

behavior -- If I put one character into a CHAR(30) field, it is nice to

know I'll only see one character on retrieval.

http://dev.mysql.com/doc/refman/5.0/en/char.html

If trailing spaces are significant, VARCHAR is the proper type (but

it appears older MySQL stripped on input to them <G>)

--

Wulfraed Dennis Lee Bieber AF6VN

wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/ja4n8b$dou$1@dough.gmane.org

©2011 Dennis Lee Bieber