Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
fdcaa6cb
Commit
fdcaa6cb
authored
Apr 07, 2013
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clarify CREATE grammar
parent
e7036ec1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
43 deletions
+21
-43
sql/sql_yacc.yy
sql/sql_yacc.yy
+21
-43
No files found.
sql/sql_yacc.yy
View file @
fdcaa6cb
...
@@ -1461,7 +1461,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
...
@@ -1461,7 +1461,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <table>
%type <table>
table_ident table_ident_nodb references xid
table_ident table_ident_nodb references xid
table_ident_opt_wild
table_ident_opt_wild
create_like
%type <simple_string>
%type <simple_string>
remember_name remember_end opt_db text_or_password
remember_name remember_end opt_db text_or_password
...
@@ -2115,7 +2115,7 @@ create:
...
@@ -2115,7 +2115,7 @@ create:
lex->name.length= 0;
lex->name.length= 0;
lex->create_last_non_select_table= lex->last_table();
lex->create_last_non_select_table= lex->last_table();
}
}
create
2
create
_body
{
{
LEX *lex= YYTHD->lex;
LEX *lex= YYTHD->lex;
lex->current_select= &lex->select_lex;
lex->current_select= &lex->select_lex;
...
@@ -4290,36 +4290,23 @@ size_number:
...
@@ -4290,36 +4290,23 @@ size_number:
End tablespace part
End tablespace part
*/
*/
create2:
create_body:
'(' create2a {}
'(' create_field_list ')'
| opt_create_table_options
{ Lex->create_info.option_list= NULL; }
opt_create_partitioning
opt_create_table_options opt_create_partitioning opt_create_select {}
create3 {}
| opt_create_table_options opt_create_partitioning opt_create_select {}
| LIKE table_ident
/*
{
the following rule is redundant, but there's a shift/reduce
THD *thd= YYTHD;
conflict that prevents the rule above from parsing a syntax like
TABLE_LIST *src_table;
CREATE TABLE t1 (SELECT 1);
LEX *lex= thd->lex;
*/
| '(' create_select ')' { Select->set_braces(1);} union_opt {}
lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
| create_like
src_table= lex->select_lex.add_table_to_list(thd, $2, NULL, 0,
TL_READ,
MDL_SHARED_READ);
if (! src_table)
MYSQL_YYABORT;
/* CREATE TABLE ... LIKE is not allowed for views. */
src_table->required_type= FRMTYPE_TABLE;
}
| '(' LIKE table_ident ')'
{
{
THD *thd= YYTHD;
TABLE_LIST *src_table;
LEX *lex= thd->lex;
lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
Lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
src_table= lex->select_lex.add_table_to_list(thd, $3, NULL, 0,
TABLE_LIST *src_table= Lex->select_lex.add_table_to_list(YYTHD,
TL_READ,
$1, NULL, 0, TL_READ, MDL_SHARED_READ);
MDL_SHARED_READ);
if (! src_table)
if (! src_table)
MYSQL_YYABORT;
MYSQL_YYABORT;
/* CREATE TABLE ... LIKE is not allowed for views. */
/* CREATE TABLE ... LIKE is not allowed for views. */
...
@@ -4327,21 +4314,12 @@ create2:
...
@@ -4327,21 +4314,12 @@ create2:
}
}
;
;
create2a:
create_like:
create_field_list ')'
LIKE table_ident { $$= $2; }
{
| '(' LIKE table_ident ')' { $$= $3; }
Lex->create_info.option_list= NULL;
}
opt_create_table_options
opt_create_partitioning
create3 {}
| opt_create_partitioning
create_select ')'
{ Select->set_braces(1);}
union_opt {}
;
;
create3
:
opt_create_select
:
/* empty */ {}
/* empty */ {}
| opt_duplicate opt_as create_select
| opt_duplicate opt_as create_select
{ Select->set_braces(0);}
{ Select->set_braces(0);}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment