Bugs item #1850187, was opened at 2007-12-13 18:03
Message generated for change (Comment added) made by mr-meltdown
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1850187&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL/Core
Group: SQL 2.20
Status: Closed
Resolution: Rejected
Priority: 5
Private: No
Submitted By: Romulo Goncalves (romulog)
Assigned to: Niels Nes (nielsnes)
Summary: length function is not working properly 

Initial Comment:
The following SQL execution will show the problem:
sql>create table test ( str VARCHAR(20), str2 VARCHAR(20));
sql>insert into test values (' test ','');
Rows affected 1
sql>select length(str), str from test;
+------------+-------+
| length_str |str    |
+============+=======+
|          5 | test  |
+------------+-------+
sql>

The length of the string is 6 and not 5 ;)

Regards,
Romulo

----------------------------------------------------------------------

>Comment By: Fabian (mr-meltdown)
Date: 2007-12-13 20:01

Message:
Logged In: YES 
user_id=963970
Originator: NO

then there are couple more bugs in mclient's rendering, and/or this
doesn't happen currently.  The code sample shows a space at the end.  Here
is JdbcClient's output, which shows that mclient's rendering is broken.

So length returns the strlen(rtrim())?  If the SQL standard is useless
like that, ok.  The space is retained in the output though.


monetdb-> start transaction;
Operation successful

auto commit mode: off
monetdb-> create table test ( str VARCHAR(20), str2 VARCHAR(20));
Operation successful

monetdb-> insert into test values (' test ','');
1 affected row

monetdb-> select length(str), str from test;
+------------+--------+
| length_str | str    |
+============+========+
|          5 |  test  |
+------------+--------+
1 row

monetdb-> 

----------------------------------------------------------------------

Comment By: Niels Nes (nielsnes)
Date: 2007-12-13 19:47

Message:
Logged In: YES 
user_id=43556
Originator: NO

rtrim as it needs to remove trailing whitespace.

----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2007-12-13 19:33

Message:
Logged In: YES 
user_id=963970
Originator: NO

Hmmm, sure it is an rtrim, because the rendering of mclient shows it is an
ltrim instead... (note the space on the right of test)

----------------------------------------------------------------------

Comment By: Romulo Goncalves (romulog)
Date: 2007-12-13 19:29

Message:
Logged In: YES 
user_id=1498628
Originator: YES

does '  test ' result in 5 too?
No its result in 6...

we currently do a special length(rtrim(x)).
The white spaces, after the last work, are not counted...
Niels just told me that, so I will close the bug. 
The resolution will be rejected.

If it is not the proper choice please let me know.

Regards,
Romulo


----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2007-12-13 18:42

Message:
Logged In: YES 
user_id=963970
Originator: NO

looks like there is an ltrim going on.

does '  test ' result in 5 too?

----------------------------------------------------------------------

Comment By: Romulo Goncalves (romulog)
Date: 2007-12-13 18:06

Message:
Logged In: YES 
user_id=1498628
Originator: YES

The problem is the space used in string: Look to the following example:
sql>insert into test values (' ','');
Rows affected 1
sql>select length(str), str from test;
+------------+-------+
| length_str |str    |
+============+=======+
|          5 | test  |
|          0 |       |
+------------+-------+
sql>


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1850187&group_id=56967

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to