Another bug with "create table ... select ..." and control flow functions

Another bug with "create table ... select ..." and control flow functions

am 03.09.2002 11:15:30 von Danilo Maurizio

Description:
As in version 4.0.3 I experienced some bugs with create ... select
statement and control flow function as if, case etc. etc.

How-To-Repeat:

Red Hat Linux release 7.2 (Enigma)
Kernel 2.4.7-10 on an i686

[danilo@osslinux danilo]$ mysql -u root

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13 to server version: 4.0.3-beta

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select if('2002'='2002','Y','N');
+---------------------------+
| if('2002'='2002','Y','N') |
+---------------------------+
| Y |
+---------------------------+
1 row in set (0.00 sec)

mysql> create table ciccio select if('2002'='2002','Y','N');
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 1

mysql> select * from ciccio;
+---------------------------+
| if('2002'='2002','Y','N') |
+---------------------------+
| 0 |
+---------------------------+
1 row in set (0.00 sec)

mysql>

- This bug affects also the Win32 version -

Fix:

The only work around is to create the table without using control flow
function and then alter the table.


Synopsis: Create table ... select ... if() statement bug
Submitter-Id:
Originator: Danilo Maurizio
Organization: Veneto Lavoro
MySQL support: none
Severity: serious
Priority: high
Category: mysqld
Class: sw-bug
Release: mysql-4.0.3

System: NT, Win2000 and Linux
Compiler: rpm for linux RH and your installer for Win32




------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail
To unsubscribe, e-mail

Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12473@lists.mysql.com
To unsubscribe, e-mail

Re: Another bug with "create table ... select ..." and control flow functions

am 04.09.2002 14:24:58 von Sinisa Milivojevic

Danilo Maurizio writes:
> Description:
> As in version 4.0.3 I experienced some bugs with create ... select
> statement and control flow function as if, case etc. etc.
>
> How-To-Repeat:
>
> Red Hat Linux release 7.2 (Enigma)
> Kernel 2.4.7-10 on an i686
>
> [danilo@osslinux danilo]$ mysql -u root
>
> Welcome to the MySQL monitor. Commands end with ; or \g.
> Your MySQL connection id is 13 to server version: 4.0.3-beta
>
> Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
> mysql> select if('2002'='2002','Y','N');
> +---------------------------+
> | if('2002'='2002','Y','N') |
> +---------------------------+
> | Y |
> +---------------------------+
> 1 row in set (0.00 sec)
>
> mysql> create table ciccio select if('2002'='2002','Y','N');
> Query OK, 1 row affected (0.01 sec)
> Records: 1 Duplicates: 0 Warnings: 1
>
> mysql> select * from ciccio;
> +---------------------------+
> | if('2002'='2002','Y','N') |
> +---------------------------+
> | 0 |
> +---------------------------+
> 1 row in set (0.00 sec)
>
> mysql>
>
> - This bug affects also the Win32 version -

Hi!

Thank you very much for your bug report.

It helped us fix a bug properly. Fix will come up in 4.0.4. This is a
patch:

===== sql/item_func.cc 1.75 vs edited =====
*** /tmp/item_func.cc-1.75-16072 Thu Aug 8 20:49:02 2002
--- edited/sql/item_func.cc Wed Sep 4 15:09:31 2002
***************
*** 173,179 ****

if (!t_arg)
return result_field;
! switch (args[0]->result_type()) {
case INT_RESULT:
if (max_length > 11)
res= new Field_longlong(max_length, maybe_null, name, t_arg,
--- 173,179 ----

if (!t_arg)
return result_field;
! switch (result_type()) {
case INT_RESULT:
if (max_length > 11)
res= new Field_longlong(max_length, maybe_null, name, t_arg,


--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12487@lists.mysql.com
To unsubscribe, e-mail