Bug #4839 CREATE VIEW with EXISTS (SELECT UNION SELECT) crashes

Submitted: 31 Jul 2004 16:52 Modified: 24 Aug 2004 8:58
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.1 OS:
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[31 Jul 2004 16:52] Georg Richter
Description:
When CREATING a VIEW with EXISTS (SELECT UNION SELECT) server crashes 

How to repeat:
5.0.1-alpha-debug-log 
[16:49] root@test> CREATE VIEW v1 AS SELECT 1 IN (SELECT 1 UNION SELECT 2); 
Query OK, 0 rows affected (0.00 sec) 
 
5.0.1-alpha-debug-log 
[16:49] root@test> CREATE VIEW v2 AS SELECT EXISTS (SELECT 1 UNION SELECT 2); 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[6 Aug 2004 3:44] MySQL Verification Team
Verified against latest BK 5.0 tree:

backtrace:

/home/miguel/dbs/5.0/libexec/mysqld: ready for connections.
Version: '5.0.2-alpha-debug-log'  socket: '/tmp/mysql.sock'  port: 3306
[New Thread 8838064 (LWP 14317)]
mysqld: sql_lex.cc:1490: void st_select_lex::print_limit(THD*, String*): Assertion `select_limit == 1L && offset_limit == 0L' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 8838064 (LWP 14317)]
0x00aac402 in ?? ()
(gdb) backtrace full
#0  0x00aac402 in ?? ()
No symbol table info available.
#1  0x00714e49 in raise () from /lib/tls/libc.so.6
No symbol table info available.
#2  0x00716872 in abort () from /lib/tls/libc.so.6
No symbol table info available.
#3  0x0070e718 in __assert_fail () from /lib/tls/libc.so.6
No symbol table info available.
#4  0x0810d0c3 in st_select_lex::print_limit (this=0x9f98098, thd=0x9f89060, str=0x86c140) at sql_lex.cc:1490
        item = (class Item_subselect *) 0x9f98650
#5  0x081f1e95 in st_select_lex::print (this=0x9f98098, thd=0x9f89060, str=0x86c140) at sql_select.cc:11742
        first = false
        it = {<base_list_iterator> = {list = 0x9f98104, el = 0x863929c, prev = 0x0, current = 0x0}, <No data fields>}
        item = (class Item *) 0x0
        cur_where = (class Item *) 0x0
        cur_having = (class Item *) 0x0
#6  0x0810ceed in st_select_lex_unit::print (this=0x9f981c8, str=0x86c140) at sql_lex.cc:1451
        sl = (SELECT_LEX *) 0x9f98098
#7  0x081685b3 in subselect_union_engine::print (this=0x0, str=0x0) at item_subselect.cc:1440
No locals.
#8  0x0816434b in Item_subselect::print (this=0x9f98650, str=0x86c140) at item_subselect.cc:251
No locals.
#9  0x08164fbd in Item_exists_subselect::print (this=0x0, str=0x86c140) at item_subselect.cc:489
No locals.
---Type <return> to continue, or q <return> to quit---
#10 0x0810f055 in Item::print_item_w_name (this=0x9f98650, str=0x86c140) at item.cc:98
No locals.
#11 0x081f1d06 in st_select_lex::print (this=0x9f89228, thd=0x9f89060, str=0x86c140) at sql_select.cc:11682
        first = false
        it = {<base_list_iterator> = {list = 0x9f89294, el = 0x9f986f0, prev = 0x0, current = 0x0}, <No data fields>}
        item = (class Item *) 0x9f98650
        cur_where = (class Item *) 0x9f98650
        cur_having = (class Item *) 0x9f98650
#12 0x0810ceed in st_select_lex_unit::print (this=0x9f890a0, str=0x86c140) at sql_lex.cc:1451
        sl = (SELECT_LEX *) 0x9f89228
#13 0x0829e2d0 in mysql_register_view (thd=0x9f89060, view=0x9f97f90, mode=VIEW_CREATE_NEW) at sql_view.cc:382
        sql_mode = 0
        buff = "select exists(select 1 AS `1`", '\0' <repeats 207 times>, "\001\000\000\000\002", '\0' <repeats 179 times>, "&#65533;\206\000_P\b\213\213G\b&#65533;\206\000&#65533;\t\005\000\000\000&#65533;\t&#65533;\t_P\bh&#65533;206\000.\211G\b\213\000\000\000P&#65533;206\000T&#65533;206\000X&#65533;206\000T&#65533;206\000X&#65533;206\000\\&#65533;206", '\0' <repeats 17 times>, "&#65533;\t\v\000\000\000`P\b&#65533;\206\000\215\210G\bl\000\000\000&#65533;206\000&#65533;206\000&#65533;206\000&#65533;206\000&#65533;206\000&#65533;206", '\0' <repeats 17 times>, "\006", '\0' <repeats 11 times>...
        str = {Ptr = 0x86c160 "select exists(select 1 AS `1`", str_length = 29, Alloced_length = 4096,
  alloced = false, str_charset = 0x861c840}
        md5 = "4&#65533;206\0008&#65533;206\000<&#65533;206\000\214c\b", '\0' <repeats 16 times>
        can_be_merged = false
        dir_buff = '\0' <repeats 316 times>, "\027\207\t&#2038;I\bX\207\t\230&#65533;206\000&#65533;\030\b\214c\b\210&#65533;206\000I\177\tI\177\tP\206\t\230\200\tt\220\t&#65533;\b\206\tI\177\t)\000\000\000`\000\000\000\000\000\000\206\t&#65533;\206\000]&#65533;025\b\206\t`\000\000\000@&#65533;\bI\177\t \000\000\000\214c\b&#65533;\206\000 \000\000\000)\177\t\214c\b\b&#65533;206\000'&#65533;020\b/..\00---Type <return> to continue, or q <return> to quit---
0\0207\t@&#65533;206\000\202\237G\b&#65533;\206\000@&#65533;206\000\001\000\000\005\000\000\000\0207\t\005\000\000\000h&#65533;206\000&#65533;235G\b&#65533;\206\000@&#65533;206\0004&#65533;...
        file_buff = '\0' <repeats 332 times>, "ž\206\000¾\206\000&#65533;\206\000&#65533;206\000\025\234G\b&#65533;000\000\000\206\000\206\000\206\000\206\000\206\000\206\000\005\000\000\000&#65533;\206\000_P\bF&#65533;206\000\003\000\000\0005\000\000\000~\206\000&#318;\206\000>\206\000&#318;\206\000&#574;\206\000\206\000\000\000\000\000/tmp/", '\0' <repeats 11 times>, "&#65533;\206\000@&#65533;206\000_P\b&#65533;237G\b@&#65533;206\000&#65533;\206", '\0' <repeats 40 times>
        dir = {str = 0x0, length = 0}
        file = {str = 0x0, length = 0}
        _db_func_ = 0x0
        _db_file_ = 0x0
        _db_level_ = 0
        _db_framep_ = (char **) 0x0
#14 0x0829e034 in mysql_create_view (thd=0x9f89060, mode=VIEW_CREATE_NEW) at sql_view.cc:289
        priv = 15
        db = 0x9f84468 "test1"
        it = {<base_list_iterator> = {list = 0x9f89294, el = 0x863929c, prev = 0x0, current = 0x0}, <No data fields>}
        item = (class Item *) 0x0
        lex = (LEX *) 0x9f89094
        link_to_local = true
        view = (TABLE_LIST *) 0x9f97f90
        tables = (TABLE_LIST *) 0x0
        tbl = (TABLE_LIST *) 0xf
        select_lex = (SELECT_LEX *) 0x9f89228
        unit = (SELECT_LEX_UNIT *) 0x9f890a0
---Type <return> to continue, or q <return> to quit---
        res = 0
        _db_func_ = 0x9f89060 "&#65533;L\bc\bc\b(L\b&#65533;230\t"
        _db_file_ = 0x9f97f90 ""
        _db_level_ = 167290220
        _db_framep_ = (char **) 0x86d208
#15 0x081ac065 in mysql_execute_command (thd=0x9f89060) at sql_parse.cc:3821
        res = 0
        lex = (LEX *) 0x9f89094
        first_table = (TABLE_LIST *) 0x9f97f90
        all_tables = (TABLE_LIST *) 0x9f97f90
        select_lex = (SELECT_LEX *) 0x9f89228
        unit = (SELECT_LEX_UNIT *) 0x9f890a0
        _db_func_ = 0x92d8c9 "&#65533;213&#65533;&#65533;e\2117&#65533;\220\220\220e\203=\f"
        _db_file_ = 0x0
        _db_level_ = 0
        _db_framep_ = (char **) 0xffffffff
#16 0x081ad3f0 in mysql_parse (thd=0x9f89060,
    inBuf=0x9f97f10 "CREATE VIEW v2 AS SELECT EXISTS (SELECT 1 UNION SELECT 2)", length=167284884) at sql_parse.cc:4428
        lex = (LEX *) 0x9f89094
        _db_func_ = 0x9d <Address 0x9d out of bounds>
        _db_file_ = 0x0
        _db_level_ = 8836976
        _db_framep_ = (char **) 0x86d774
#17 0x081a57fb in dispatch_command (command=COM_QUERY, thd=0x9f89060,
---Type <return> to continue, or q <return> to quit---
    packet=0x9f93eb1 "CREATE VIEW v2 AS SELECT EXISTS (SELECT 1 UNION SELECT 2)", packet_length=58)
    at sql_parse.cc:1486
        net = (NET *) 0x9f896d8
        error = false
        _db_func_ = 0x8641fe0 ""
        _db_file_ = 0x86dbb0 "&#65533;206"
        _db_level_ = 8837160
        _db_framep_ = (char **) 0x847be77
        start_of_query = 167284832
#18 0x081a50f0 in do_command (thd=0x9f89060) at sql_parse.cc:1296
        packet = 0x9f93eb0 "\003CREATE VIEW v2 AS SELECT EXISTS (SELECT 1 UNION SELECT 2)"
        old_timeout = 30
        packet_length = 58
        net = (NET *) 0x9f896d8
        command = COM_QUERY
        _db_func_ = 0x817f09b "\213]\211&#65533;&#65533;\211&#65533;203&#65533;\211]\213]\b\211\034$&#65533;212"
        _db_file_ = 0x9f8a3e4 "H\t"
        _db_level_ = 8192
        _db_framep_ = (char **) 0x1000
#19 0x081a4561 in handle_one_connection (arg=0x0) at sql_parse.cc:1032
        error = 14317
        net = (NET *) 0x9f896d8
        thd = (class THD *) 0x9f89060
        launch_time = 0
---Type <return> to continue, or q <return> to quit---
        set = {__val = {0 <repeats 32 times>}}
#20 0x0092798c in start_thread () from /lib/tls/libpthread.so.0
No symbol table info available.
#21 0x007a916a in clone () from /lib/tls/libc.so.6
No symbol table info available.
[23 Aug 2004 12:22] Oleksandr Byelkin
ChangeSet 
  1.1726 04/08/23 13:19:59 bell@sanja.is.com.ua +3 -0 
  fixed LIMIT clause printing (BUG#4839)
[24 Aug 2004 8:58] Oleksandr Byelkin
Thank you for bug report. Bug is fixed, patch is pushed in our source repository

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.054 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.