FAQ
Can you force it to keep the space by escaping the space?
Something like:

mysql> insert into test_strings set foo_1=' test\ ',foo_2=' test\
',foo_3=' test\
',foo_4=' test\ ';

On Oct 24, 2005, at 5:34 AM, Andreas Steichardt wrote:

Hi!

I just hit something really strange which is either a bug in MySQL or a
dumbness bug of me.

I am trying to insert a string ending with a simple space and i really
want
this space at the end of my string ;). Unfortunately MySQL kills this
whitespace when inserting into normal (var)char columns:

mysql> create table test_strings (foo_1 varchar(255),foo_2
char(255),foo_3
text,foo_4 blob);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test_strings set foo_1=' test ',foo_2=' test
',foo_3=' test
',foo_4=' test ';
Query OK, 1 row affected (0.00 sec)

mysql> select length(foo_1),length(foo_2),length(foo_3),length(foo_4)
from
test_strings;
+---------------+---------------+---------------+---------------+
length(foo_1) | length(foo_2) | length(foo_3) | length(foo_4) |
+---------------+---------------+---------------+---------------+
5 | 5 | 6 | 6 |
+---------------+---------------+---------------+---------------+
1 row in set (0.00 sec)

Is this a feature or am i missing something. text would do it for me
but it is
a total waste of space.

Any ideas?

Kind regards,

Andreas Streichardt

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=bmartin@mac.com
Bruce Martin
The Martin Solution
PO Box 644
Delaware Water Gap, PA
(570) 421-0670
bruce@martinsolution.com

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 4 | next ›
Discussion Overview
groupmysql @
categoriesmysql
postedOct 24, '05 at 9:29a
activeOct 24, '05 at 10:52a
posts4
users3
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2022 Grokbase