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

Author: Uwe Grauer

Posted: 2011-11-18 at 11:28:32

On 11/18/2011 12:26 AM, Paul McNett wrote:

> I'm using PostgreSQL for the first time, after long-time use of MySQL and SQLite. So

> far so good, although I noticed a pretty key difference in character fields. For a

> column definition of 'last_name char(30)', the following code:

>

> biz.Record.last_name

>

> Will result in the following on PostgreSQL:

>

> "McNett"

>

> Which surprised me greatly, because it results in the following output on MySQL and

> SQLite:

>

> "McNett"

>

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

> discussed before. Right?

>

> Paul

Most databases use trailing spaces in char fields which are shorter than

the defined lenght.

Maybe MySql uses this representation for convenience.

How does "abc " and "abc" compare for char fields in Mysql.

Are those equal??

See:

http://troels.arvin.dk/db/rdbms/#data_types-char

http://docs.oracle.com/cd/B13789_01/appdev.101/b10807/b_char.htm#i1596

Uwe

_______________________________________________

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/4EC687B0.9090602@googlemail.com

©2011 Uwe Grauer