~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to sql/sql_yacc.yy

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
481
481
  struct st_lex *lex;
482
482
  sp_head *sphead;
483
483
  struct p_elem_val *p_elem_value;
 
484
  enum index_hint_type index_hint;
484
485
}
485
486
 
486
487
%{
492
493
  Currently there is 287 shift/reduce conflict. We should not introduce
493
494
  new conflicts any more.
494
495
*/
495
 
%expect 287
 
496
%expect 286
496
497
 
497
498
/*
498
499
   Comments for TOKENS.
779
780
%token  MASTER_SSL_CIPHER_SYM
780
781
%token  MASTER_SSL_KEY_SYM
781
782
%token  MASTER_SSL_SYM
 
783
%token  MASTER_SSL_VERIFY_SERVER_CERT_SYM
782
784
%token  MASTER_SYM
783
785
%token  MASTER_USER_SYM
784
786
%token  MATCH                         /* SQL-2003-R */
1162
1164
        btree_or_rtree
1163
1165
 
1164
1166
%type <string_list>
1165
 
        key_usage_list using_list
 
1167
        using_list
1166
1168
 
1167
1169
%type <key_part>
1168
1170
        key_part
1233
1235
        opt_column_list grant_privileges grant_ident grant_list grant_option
1234
1236
        object_privilege object_privilege_list user_list rename_list
1235
1237
        clear_privileges flush_options flush_option
1236
 
        equal optional_braces opt_key_definition key_usage_list2
 
1238
        equal optional_braces
1237
1239
        opt_mi_check_type opt_to mi_check_types normal_join
1238
1240
        db_to_db table_to_table_list table_to_table opt_table_list opt_as
1239
1241
        handler_rkey_function handler_read_or_scan
1246
1248
        statement sp_suid
1247
1249
        sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa
1248
1250
        load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
1249
 
        definer view_replace_or_algorithm view_replace view_algorithm_opt
 
1251
        definer view_replace_or_algorithm view_replace
1250
1252
        view_algorithm view_or_trigger_or_sp_or_event
1251
1253
        view_or_trigger_or_sp_or_event_tail
1252
1254
        view_suid view_tail view_list_opt view_list view_select
1269
1271
%type <spblock> sp_decls sp_decl
1270
1272
%type <lex> sp_cursor_stmt
1271
1273
%type <spname> sp_name
 
1274
%type <index_hint> index_hint_type
 
1275
%type <num> index_hint_clause
1272
1276
 
1273
1277
%type <NONE>
1274
1278
        '-' '+' '*' '/' '%' '(' ')'
1525
1529
         {
1526
1530
           Lex->mi.ssl_key= $3.str;
1527
1531
         }
 
1532
       | MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
 
1533
         {
 
1534
           Lex->mi.ssl_verify_server_cert= $3 ?
 
1535
               LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
 
1536
         }
1528
1537
       |
1529
1538
         master_file_def
1530
1539
       ;
1767
1776
opt_ev_status: /* empty */ { $$= 0; }
1768
1777
        | ENABLE_SYM
1769
1778
          {
1770
 
            Lex->event_parse_data->status= Event_parse_data::ENABLED;
 
1779
            Lex->event_parse_data->status= Event_basic::ENABLED;
 
1780
            $$= 1;
 
1781
          }
 
1782
        | DISABLE_SYM ON SLAVE
 
1783
          {
 
1784
            Lex->event_parse_data->status= Event_basic::SLAVESIDE_DISABLED;
1771
1785
            $$= 1;
1772
1786
          }
1773
1787
        | DISABLE_SYM
1774
1788
          {
1775
 
            Lex->event_parse_data->status= Event_parse_data::DISABLED;
 
1789
            Lex->event_parse_data->status= Event_basic::DISABLED;
1776
1790
            $$= 1;
1777
1791
          }
1778
1792
      ;
1802
1816
          ON COMPLETION_SYM PRESERVE_SYM
1803
1817
          {
1804
1818
            Lex->event_parse_data->on_completion=
1805
 
                                  Event_parse_data::ON_COMPLETION_PRESERVE;
 
1819
                                  Event_basic::ON_COMPLETION_PRESERVE;
1806
1820
            $$= 1;
1807
1821
          }
1808
1822
        | ON COMPLETION_SYM NOT_SYM PRESERVE_SYM
1809
1823
          {
1810
1824
            Lex->event_parse_data->on_completion=
1811
 
                                  Event_parse_data::ON_COMPLETION_DROP;
 
1825
                                  Event_basic::ON_COMPLETION_DROP;
1812
1826
            $$= 1;
1813
1827
          }
1814
1828
      ;
1844
1858
            */
1845
1859
            if (lex->sphead)
1846
1860
            {
1847
 
              my_error(ER_EVENT_RECURSIVITY_FORBIDDEN, MYF(0));
 
1861
              my_error(ER_EVENT_RECURSION_FORBIDDEN, MYF(0));
1848
1862
              MYSQL_YYABORT;
1849
1863
            }
1850
1864
              
1917
1931
              my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
1918
1932
              MYSQL_YYABORT;
1919
1933
            }
1920
 
            if (check_routine_name($3))
 
1934
            if (check_routine_name(&$3))
1921
1935
            {
1922
 
              my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
1923
1936
              MYSQL_YYABORT;
1924
1937
            }
1925
 
            $$= new sp_name($1, $3);
 
1938
            $$= new sp_name($1, $3, true);
1926
1939
            $$->init_qname(YYTHD);
1927
1940
          }
1928
1941
        | ident
1929
1942
          {
1930
1943
            THD *thd= YYTHD;
1931
1944
            LEX_STRING db;
1932
 
            if (check_routine_name($1))
 
1945
            if (check_routine_name(&$1))
1933
1946
            {
1934
 
              my_error(ER_SP_WRONG_NAME, MYF(0), $1.str);
1935
1947
              MYSQL_YYABORT;
1936
1948
            }
1937
1949
            if (thd->copy_db_to(&db.str, &db.length))
1938
1950
              MYSQL_YYABORT;
1939
 
            $$= new sp_name(db, $1);
 
1951
            $$= new sp_name(db, $1, false);
1940
1952
            if ($$)
1941
1953
              $$->init_qname(YYTHD);
1942
1954
          }
2404
2416
          {
2405
2417
            LEX *lex= Lex;
2406
2418
            sp_head *sp= lex->sphead;
 
2419
 
 
2420
            lex->spcont= lex->spcont->push_context(LABEL_HANDLER_SCOPE);
 
2421
 
2407
2422
            sp_pcontext *ctx= lex->spcont;
2408
2423
            sp_instr_hpush_jump *i=
2409
2424
              new sp_instr_hpush_jump(sp->instructions(), ctx, $2,
2411
2426
 
2412
2427
            sp->add_instr(i);
2413
2428
            sp->push_backpatch(i, ctx->push_label((char *)"", 0));
2414
 
            sp->m_flags|= sp_head::IN_HANDLER;
2415
2429
          }
2416
2430
          sp_hcond_list sp_proc_stmt
2417
2431
          {
2435
2449
              sp->push_backpatch(i, lex->spcont->last_label()); /* Block end */
2436
2450
            }
2437
2451
            lex->sphead->backpatch(hlab);
2438
 
            sp->m_flags&= ~sp_head::IN_HANDLER;
 
2452
 
 
2453
            lex->spcont= ctx->pop_context();
 
2454
 
2439
2455
            $$.vars= $$.conds= $$.curs= 0;
2440
2456
            $$.hndlrs= $6;
2441
 
            ctx->add_handlers($6);
 
2457
            lex->spcont->add_handlers($6);
2442
2458
          }
2443
2459
        | DECLARE_SYM ident CURSOR_SYM FOR_SYM sp_cursor_stmt
2444
2460
          {
2504
2520
        ;
2505
2521
 
2506
2522
sp_hcond_list:
 
2523
          sp_hcond_element
 
2524
          { $$= 1; }
 
2525
        | sp_hcond_list ',' sp_hcond_element
 
2526
          { $$+= 1; }
 
2527
        ;
 
2528
 
 
2529
sp_hcond_element:
2507
2530
          sp_hcond
2508
2531
          {
2509
2532
            LEX *lex= Lex;
2510
2533
            sp_head *sp= lex->sphead;
2511
 
            sp_pcontext *ctx= lex->spcont;
 
2534
            sp_pcontext *ctx= lex->spcont->parent_context();
2512
2535
 
2513
2536
            if (ctx->find_handler($1))
2514
2537
            {
2522
2545
 
2523
2546
              i->add_condition($1);
2524
2547
              ctx->push_handler($1);
2525
 
              $$= 1;
2526
 
            }
2527
 
          }
2528
 
        | sp_hcond_list ',' sp_hcond
2529
 
          {
2530
 
            LEX *lex= Lex;
2531
 
            sp_head *sp= lex->sphead;
2532
 
            sp_pcontext *ctx= lex->spcont;
2533
 
 
2534
 
            if (ctx->find_handler($3))
2535
 
            {
2536
 
              my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0));
2537
 
              MYSQL_YYABORT;
2538
 
            }
2539
 
            else
2540
 
            {
2541
 
              sp_instr_hpush_jump *i=
2542
 
                (sp_instr_hpush_jump *)sp->last_instruction();
2543
 
 
2544
 
              i->add_condition($3);
2545
 
              ctx->push_handler($3);
2546
 
              $$= $1 + 1;
2547
2548
            }
2548
2549
          }
2549
2550
        ;
2703
2704
              else
2704
2705
                i->m_query.length= lex->tok_end - sp->m_tmp_query;
2705
2706
              i->m_query.str= strmake_root(YYTHD->mem_root,
2706
 
                                           (char *)sp->m_tmp_query,
 
2707
                                           sp->m_tmp_query,
2707
2708
                                           i->m_query.length);
2708
2709
              sp->add_instr(i);
2709
2710
            }
3122
3123
            sp_label_t *lab= lex->spcont->last_label();
3123
3124
 
3124
3125
            lab->type= SP_LAB_BEGIN;
3125
 
            lex->spcont= lex->spcont->push_context();
 
3126
            lex->spcont= lex->spcont->push_context(LABEL_DEFAULT_SCOPE);
3126
3127
          }
3127
3128
          sp_decls
3128
3129
          sp_proc_stmts
4537
4538
        type opt_attribute
4538
4539
        {
4539
4540
          LEX *lex=Lex;
4540
 
          if (add_field_to_list(lex->thd, $1.str,
4541
 
                                (enum enum_field_types) $3,
 
4541
          if (add_field_to_list(lex->thd, &$1, (enum enum_field_types) $3,
4542
4542
                                lex->length,lex->dec,lex->type,
4543
4543
                                lex->default_value, lex->on_update_value, 
4544
4544
                                &lex->comment,
5154
5154
            lex->sql_command= SQLCOM_ALTER_FUNCTION;
5155
5155
            lex->spname= $3;
5156
5156
          }
5157
 
        | ALTER view_algorithm_opt definer view_suid
5158
 
          VIEW_SYM table_ident
5159
 
          {
5160
 
            THD *thd= YYTHD;
5161
 
            LEX *lex= thd->lex;
5162
 
            lex->sql_command= SQLCOM_CREATE_VIEW;
5163
 
            lex->create_view_mode= VIEW_ALTER;
5164
 
            /* first table in list is target VIEW name */
5165
 
            lex->select_lex.add_table_to_list(thd, $6, NULL, TL_OPTION_UPDATING);
5166
 
          }
5167
 
          view_list_opt AS view_select view_check_option
5168
 
          {}
 
5157
        | ALTER view_algorithm definer
 
5158
          {
 
5159
            Lex->create_view_mode= VIEW_ALTER;
 
5160
          }
 
5161
          view_tail
 
5162
          {}
 
5163
        | ALTER definer
 
5164
          /*
 
5165
            We have two separate rules for ALTER VIEW rather that
 
5166
            optional view_algorithm above, to resolve the ambiguity
 
5167
            with the ALTER EVENT below.
 
5168
          */
 
5169
          {
 
5170
            LEX *lex= Lex;
 
5171
            lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED;
 
5172
            lex->create_view_mode= VIEW_ALTER;
 
5173
          }
 
5174
          view_tail
 
5175
          {}
5169
5176
        | ALTER definer EVENT_SYM sp_name
5170
5177
          /*
5171
5178
            BE CAREFUL when you add a new rule to update the block where
5487
5494
          type opt_attribute
5488
5495
          {
5489
5496
            LEX *lex=Lex;
5490
 
            if (add_field_to_list(lex->thd,$3.str,
 
5497
            if (add_field_to_list(lex->thd,&$3,
5491
5498
                                  (enum enum_field_types) $5,
5492
5499
                                  lex->length,lex->dec,lex->type,
5493
5500
                                  lex->default_value, lex->on_update_value,
5940
5947
assign_to_keycache:
5941
5948
        table_ident cache_keys_spec
5942
5949
        {
5943
 
          LEX *lex=Lex;
5944
 
          SELECT_LEX *sel= &lex->select_lex;
5945
 
          if (!sel->add_table_to_list(lex->thd, $1, NULL, 0,
5946
 
                                      TL_READ,
5947
 
                                      sel->get_use_index(),
5948
 
                                      (List<String> *)0))
 
5950
          if (!Select->add_table_to_list(YYTHD, $1, NULL, 0, TL_READ, 
 
5951
                                      Select->pop_index_hints()))
5949
5952
            MYSQL_YYABORT;
5950
5953
        }
5951
5954
        ;
5972
5975
preload_keys:
5973
5976
        table_ident cache_keys_spec opt_ignore_leaves
5974
5977
        {
5975
 
          LEX *lex=Lex;
5976
 
          SELECT_LEX *sel= &lex->select_lex;
5977
 
          if (!sel->add_table_to_list(lex->thd, $1, NULL, $3,
5978
 
                                      TL_READ,
5979
 
                                      sel->get_use_index(),
5980
 
                                      (List<String> *)0))
 
5978
          if (!Select->add_table_to_list(YYTHD, $1, NULL, $3, TL_READ,
 
5979
                                      Select->pop_index_hints()))
5981
5980
            MYSQL_YYABORT;
5982
5981
        }
5983
5982
        ;
5984
5983
 
5985
5984
cache_keys_spec:
5986
 
        { Select->interval_list.empty(); }
 
5985
        { 
 
5986
          Lex->select_lex.alloc_index_hints(YYTHD);
 
5987
          Select->set_index_hint_type(INDEX_HINT_USE, 
 
5988
                                      global_system_variables.old_mode ? 
 
5989
                                        INDEX_HINT_MASK_JOIN : 
 
5990
                                        INDEX_HINT_MASK_ALL);
 
5991
        }
5987
5992
        cache_key_list_or_empty
5988
 
        {
5989
 
          LEX *lex=Lex;
5990
 
          SELECT_LEX *sel= &lex->select_lex;
5991
 
          sel->use_index= sel->interval_list;
5992
 
        }
5993
5993
        ;
5994
5994
 
5995
5995
cache_key_list_or_empty:
5996
 
        /* empty */     { Lex->select_lex.use_index_ptr= 0; }
5997
 
        | opt_key_or_index '(' key_usage_list2 ')'
5998
 
          {
5999
 
            SELECT_LEX *sel= &Lex->select_lex;
6000
 
            sel->use_index_ptr= &sel->use_index;
6001
 
          }
 
5996
        /* empty */     { }
 
5997
        | key_or_index '(' opt_key_usage_list ')'
6002
5998
        ;
6003
5999
 
6004
6000
opt_ignore_leaves:
6929
6925
 
6930
6926
          builder= find_qualified_function_builder(thd);
6931
6927
          DBUG_ASSERT(builder);
6932
 
          item= builder->create(thd, $1, $3, $5);
 
6928
          item= builder->create(thd, $1, $3, true, $5);
6933
6929
 
6934
6930
          if (! ($$= item))
6935
6931
          {
7371
7367
table_factor:
7372
7368
        {
7373
7369
          SELECT_LEX *sel= Select;
7374
 
          sel->use_index_ptr=sel->ignore_index_ptr=0;
7375
7370
          sel->table_join_options= 0;
7376
7371
        }
7377
7372
        table_ident opt_table_alias opt_key_definition
7378
7373
        {
7379
 
          LEX *lex= Lex;
7380
 
          SELECT_LEX *sel= lex->current_select;
7381
 
          if (!($$= sel->add_table_to_list(lex->thd, $2, $3,
7382
 
                                           sel->get_table_join_options(),
7383
 
                                           lex->lock_option,
7384
 
                                           sel->get_use_index(),
7385
 
                                           sel->get_ignore_index())))
 
7374
          if (!($$= Select->add_table_to_list(YYTHD, $2, $3,
 
7375
                                           Select->get_table_join_options(),
 
7376
                                           Lex->lock_option,
 
7377
                                           Select->pop_index_hints())))
7386
7378
            MYSQL_YYABORT;
7387
 
          sel->add_joined_table($$);
 
7379
          Select->add_joined_table($$);
7388
7380
        }
7389
7381
        | '{' ident table_ref LEFT OUTER JOIN_SYM table_ref
7390
7382
          ON
7453
7445
            lex->current_select= sel= unit->outer_select();
7454
7446
            if (!($$= sel->
7455
7447
                  add_table_to_list(lex->thd, new Table_ident(unit), $6, 0,
7456
 
                                    TL_READ,(List<String> *)0,
7457
 
                                    (List<String> *)0)))
 
7448
                                    TL_READ)))
7458
7449
 
7459
7450
              MYSQL_YYABORT;
7460
7451
            sel->add_joined_table($$);
7553
7544
        /* empty */     {}
7554
7545
        | OUTER         {};
7555
7546
 
 
7547
index_hint_clause:
 
7548
       /* empty */             
 
7549
         { 
 
7550
            $$= global_system_variables.old_mode ? 
 
7551
                  INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL; 
 
7552
         } 
 
7553
       | FOR_SYM JOIN_SYM      { $$= INDEX_HINT_MASK_JOIN;  }
 
7554
       | FOR_SYM ORDER_SYM BY  { $$= INDEX_HINT_MASK_ORDER; }
 
7555
       | FOR_SYM GROUP_SYM BY  { $$= INDEX_HINT_MASK_GROUP; }
 
7556
       ;
 
7557
 
 
7558
index_hint_type:
 
7559
       FORCE_SYM  { $$= INDEX_HINT_FORCE; }
 
7560
       | IGNORE_SYM { $$= INDEX_HINT_IGNORE; } 
 
7561
       ;
 
7562
 
 
7563
index_hint_definition:
 
7564
       index_hint_type key_or_index index_hint_clause
 
7565
       {
 
7566
         Select->set_index_hint_type($1, $3);
 
7567
       }
 
7568
       '(' key_usage_list ')'
 
7569
       | USE_SYM key_or_index index_hint_clause
 
7570
       {
 
7571
         Select->set_index_hint_type(INDEX_HINT_USE, $3);
 
7572
       }
 
7573
       '(' opt_key_usage_list ')'
 
7574
       ;
 
7575
 
 
7576
index_hints_list:
 
7577
       index_hint_definition         
 
7578
       | index_hints_list index_hint_definition
 
7579
       ;
 
7580
 
 
7581
opt_index_hints_list:
 
7582
       /* empty */
 
7583
       | { Select->alloc_index_hints(YYTHD); } index_hints_list
 
7584
       ;
 
7585
 
7556
7586
opt_key_definition:
7557
 
        /* empty */     {}
7558
 
        | USE_SYM    key_usage_list
7559
 
          {
7560
 
            SELECT_LEX *sel= Select;
7561
 
            sel->use_index= *$2;
7562
 
            sel->use_index_ptr= &sel->use_index;
7563
 
          }
7564
 
        | FORCE_SYM key_usage_list
7565
 
          {
7566
 
            SELECT_LEX *sel= Select;
7567
 
            sel->use_index= *$2;
7568
 
            sel->use_index_ptr= &sel->use_index;
7569
 
            sel->table_join_options|= TL_OPTION_FORCE_INDEX;
7570
 
          }
7571
 
        | IGNORE_SYM key_usage_list
7572
 
          {
7573
 
            SELECT_LEX *sel= Select;
7574
 
            sel->ignore_index= *$2;
7575
 
            sel->ignore_index_ptr= &sel->ignore_index;
7576
 
          };
 
7587
       {  Select->clear_index_hints(); }
 
7588
       opt_index_hints_list
 
7589
       ;
 
7590
 
 
7591
opt_key_usage_list:
 
7592
        /* empty */             { Select->add_index_hint(YYTHD, NULL, 0); }
 
7593
        | key_usage_list        {}
 
7594
        ;
 
7595
 
 
7596
key_usage_element:
 
7597
        ident           { Select->add_index_hint(YYTHD, $1.str, $1.length); }
 
7598
        | PRIMARY_SYM   
 
7599
          { 
 
7600
            Select->add_index_hint(YYTHD, (char *)"PRIMARY", 7); 
 
7601
          }
 
7602
        ;
7577
7603
 
7578
7604
key_usage_list:
7579
 
        key_or_index { Select->interval_list.empty(); }
7580
 
        '(' key_list_or_empty ')'
7581
 
        { $$= &Select->interval_list; }
7582
 
        ;
7583
 
 
7584
 
key_list_or_empty:
7585
 
        /* empty */             {}
7586
 
        | key_usage_list2       {}
7587
 
        ;
7588
 
 
7589
 
key_usage_list2:
7590
 
        key_usage_list2 ',' ident
7591
 
        { Select->
7592
 
            interval_list.push_back(new (YYTHD->mem_root) String((const char*) $3.str, $3.length,
7593
 
                                    system_charset_info)); }
7594
 
        | ident
7595
 
        { Select->
7596
 
            interval_list.push_back(new (YYTHD->mem_root) String((const char*) $1.str, $1.length,
7597
 
                                    system_charset_info)); }
7598
 
        | PRIMARY_SYM
7599
 
        { Select->
7600
 
            interval_list.push_back(new (YYTHD->mem_root) String("PRIMARY", 7,
7601
 
                                    system_charset_info)); };
 
7605
        key_usage_element
 
7606
        | key_usage_list ',' key_usage_element
 
7607
        ;
7602
7608
 
7603
7609
using_list:
7604
7610
        ident
9301
9307
            my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
9302
9308
            MYSQL_YYABORT;
9303
9309
          }
9304
 
          item= new Item_param((uint) (lex->tok_start - (uchar *) thd->query));
 
9310
          item= new Item_param((uint) (lex->tok_start - thd->query));
9305
9311
          if (!($$= item) || lex->param_list.push_back(item))
9306
9312
          {
9307
9313
            my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
9713
9719
          $$->host.str= (char *) "%";
9714
9720
          $$->host.length= 1;
9715
9721
 
9716
 
          if (check_string_length(&$$->user,
9717
 
                                  ER(ER_USERNAME), USERNAME_LENGTH))
 
9722
          if (check_string_char_length(&$$->user, ER(ER_USERNAME),
 
9723
                                       USERNAME_CHAR_LENGTH,
 
9724
                                       system_charset_info, 0))
9718
9725
            MYSQL_YYABORT;
9719
9726
        }
9720
9727
        | ident_or_text '@' ident_or_text
9724
9731
              MYSQL_YYABORT;
9725
9732
            $$->user = $1; $$->host=$3;
9726
9733
 
9727
 
            if (check_string_length(&$$->user,
9728
 
                                    ER(ER_USERNAME), USERNAME_LENGTH) ||
9729
 
                check_string_length(&$$->host,
9730
 
                                    ER(ER_HOSTNAME), HOSTNAME_LENGTH))
 
9734
            if (check_string_char_length(&$$->user, ER(ER_USERNAME),
 
9735
                                         USERNAME_CHAR_LENGTH,
 
9736
                                         system_charset_info, 0) ||
 
9737
                check_string_byte_length(&$$->host, ER(ER_HOSTNAME),
 
9738
                                         HOSTNAME_LENGTH))
9731
9739
              MYSQL_YYABORT;
9732
9740
          }
9733
9741
        | CURRENT_USER optional_braces
10137
10145
              if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5)))
10138
10146
                MYSQL_YYABORT;
10139
10147
 
10140
 
              strmake(strmake(qbuff.str, "SET ", 4), (char *)sp->m_tmp_query,
 
10148
              strmake(strmake(qbuff.str, "SET ", 4), sp->m_tmp_query,
10141
10149
                      qbuff.length);
10142
10150
              qbuff.length+= 4;
10143
10151
              i->m_query= qbuff;
10357
10365
              MYSQL_YYABORT;
10358
10366
            $$.var= tmp;
10359
10367
            $$.base_name= null_lex_str;
10360
 
            /*
10361
 
              If this is time_zone variable we should open time zone
10362
 
              describing tables 
10363
 
            */
10364
 
            if (tmp == &sys_time_zone &&
10365
 
                lex->add_time_zone_tables_to_query_tables(YYTHD))
10366
 
              MYSQL_YYABORT;
10367
 
            else if (spc && tmp == &sys_autocommit)
 
10368
            if (spc && tmp == &sys_autocommit)
10368
10369
            {
10369
10370
              /*
10370
10371
                We don't allow setting AUTOCOMMIT from a stored function
10842
10843
        | table_ident
10843
10844
          {
10844
10845
            LEX *lex=Lex;
10845
 
            if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,0))
 
10846
            if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,
 
10847
                                                        TL_OPTION_UPDATING))
10846
10848
              MYSQL_YYABORT;
10847
10849
            if (lex->grant == GLOBAL_ACLS)
10848
10850
              lex->grant =  TABLE_ACLS & ~GRANT_ACL;
11084
11086
        UNION_SYM union_option
11085
11087
        {
11086
11088
          LEX *lex=Lex;
11087
 
          if (lex->exchange)
 
11089
          if (lex->result)
11088
11090
          {
11089
11091
            /* Only the last SELECT can have  INTO...... */
11090
11092
            my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");
11298
11300
        { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
11299
11301
        ;
11300
11302
 
11301
 
view_algorithm_opt:
11302
 
        /* empty */
11303
 
        { Lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; }
11304
 
        | view_algorithm
11305
 
        {}
11306
 
        ;
11307
 
 
11308
11303
view_suid:
11309
11304
        /* empty */
11310
11305
        { Lex->create_view_suid= VIEW_SUID_DEFAULT; }
11370
11365
        {
11371
11366
          THD *thd= YYTHD;
11372
11367
          LEX *lex= thd->lex;
11373
 
          char *stmt_beg= (lex->sphead ?
11374
 
                           (char *)lex->sphead->m_tmp_query :
11375
 
                           thd->query);
 
11368
          const char *stmt_beg= (lex->sphead ?
 
11369
                                 lex->sphead->m_tmp_query : thd->query);
11376
11370
          lex->create_view_select_start= $2 - stmt_beg;
11377
11371
        }
11378
11372
        | '(' remember_name select_paren ')' union_opt
11379
11373
        {
11380
11374
          THD *thd= YYTHD;
11381
11375
          LEX *lex= thd->lex;
11382
 
          char *stmt_beg= (lex->sphead ?
11383
 
                           (char *)lex->sphead->m_tmp_query :
11384
 
                           thd->query);
 
11376
          const char *stmt_beg= (lex->sphead ?
 
11377
                                 lex->sphead->m_tmp_query : thd->query);
11385
11378
          lex->create_view_select_start= $2 - stmt_beg;
11386
11379
        }
11387
11380
        ;