List:General Discussion« Previous MessageNext Message »
From:Victoria Reznichenko Date:January 15 2004 12:36pm
Subject:Re: Problem with LPAD() function
View as plain text  
"Director General: NEFACOMP" <dg@stripped> wrote:
> I am using 4.1.0 and 4.1.1 on Windows
> On WinXP, it even crashes the server when I add extra date fields.
> On Win2k AS, it doesn't crash the MySQL server but it returns unexpected
> results.

Thanks for report! It's a known bug:
	http://bugs.mysql.com/bug.php?id=2182

> 
> Thanks
> Emery
> ----- Original Message -----
> From: "Victoria Reznichenko" <victoria.reznichenko@stripped>
> To: <mysql@stripped>
> Sent: Monday, January 12, 2004 12:36
> Subject: Re: Problem with LPAD() function
> 
> 
>> "Director General: NEFACOMP" <dg@stripped> wrote:
>>
>> > I think there is a bug in LPAD() function.
>> >
>> > Just try to run this query:
>> >     SELECT LPAD(12, 3, '0');
>> >         This will correctly return 012 as expected.
>> >
>> > But when I run
>> >     SELECT LPAD(512, 3, '0');
>> >         It doesn't return 512, instead it returns special characters.
>> >
>> > With that situation I tried the following
>> >     SELECT LPAD('512', 3, '0');
>> >         And it worked as required.
>> >
>> > So, my conclusion will be that the type conversion will only take place
> when the number of characters to PAD is bigger than the length of the
> original string.
>>
>> What version do you use?
>> Works like a charm for me:
>>
>> mysql> SELECT LPAD(12, 3, '0');
>> +------------------+
>> | LPAD(12, 3, '0') |
>> +------------------+
>> | 012              |
>> +------------------+
>> 1 row in set (0.00 sec)
>>
>> mysql> SELECT LPAD(512, 3, '0');
>> +-------------------+
>> | LPAD(512, 3, '0') |
>> +-------------------+
>> | 512               |
>> +-------------------+
>> 1 row in set (0.00 sec)
>>
> 
> 
> 


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   Victoria.Reznichenko@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




Thread
Problem with LPAD() functionDirector General: NEFACOMP12 Jan
  • Re: Problem with LPAD() functionVictoria Reznichenko12 Jan
  • Re: Problem with LPAD() functionDirector General: NEFACOMP14 Jan
    • Re: Problem with LPAD() functionVictoria Reznichenko15 Jan