Bug with subselect and union
am 06.12.2002 04:17:29 von Jocelyn Fournier
Hi,
How-to-repeat :
mysql> SELECT 2 as a,(SELECT a UNION SELECT 2);
ERROR 1054: Unknown column 'a' in 'field list'
However :
mysql> SELECT 2 as a,(SELECT 2 UNION SELECT a);
+---+---------------------------+
| a | (SELECT 2 UNION SELECT a) |
+---+---------------------------+
| 2 | 2 |
+---+---------------------------+
1 row in set (0.00 sec)
mysql> SELECT 2 as a,(SELECT a);
+---+------------+
| a | (SELECT a) |
+---+------------+
| 2 | 2 |
+---+------------+
1 row in set (0.00 sec)
Regards,
Jocelyn
------------------------------------------------------------ ---------
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-thread13229@lists.mysql.com
To unsubscribe, e-mail
Re: Bug with subselect and union
am 09.12.2002 14:53:10 von Sinisa Milivojevic
Jocelyn Fournier writes:
> Hi,
>
> How-to-repeat :
>
> mysql> SELECT 2 as a,(SELECT a UNION SELECT 2);
> ERROR 1054: Unknown column 'a' in 'field list'
>
> However :
>
> mysql> SELECT 2 as a,(SELECT 2 UNION SELECT a);
> +---+---------------------------+
> | a | (SELECT 2 UNION SELECT a) |
> +---+---------------------------+
> | 2 | 2 |
> +---+---------------------------+
> 1 row in set (0.00 sec)
>
> mysql> SELECT 2 as a,(SELECT a);
> +---+------------+
> | a | (SELECT a) |
> +---+------------+
> | 2 | 2 |
> +---+------------+
> 1 row in set (0.00 sec)
>
> Regards,
> Jocelyn
>
Thank you for your bug report, which helped us fix a bug.
This is a patch:
===== sql/sql_union.cc 1.52 vs edited =====
*** /tmp/sql_union.cc-1.52-8625 Fri Dec 6 21:11:24 2002
--- edited/sql/sql_union.cc Mon Dec 9 15:44:53 2002
***************
*** 125,130 ****
--- 125,131 ----
SELECT_LEX_NODE *lex_select_save= thd->lex.current_select;
SELECT_LEX *sl;
+ thd->lex.current_select=first_select();
/* Global option */
if (((void*)(global_parameters)) == ((void*)this))
{
--
MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / 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-thread13249@lists.mysql.com
To unsubscribe, e-mail