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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7a525e7e
Commit
7a525e7e
authored
Mar 24, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parser: no implicit NOT NULL for system fields [fixes #163]
parent
14f007f9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
7 deletions
+27
-7
mysql-test/suite/versioning/r/alter.result
mysql-test/suite/versioning/r/alter.result
+2
-2
mysql-test/suite/versioning/r/create.result
mysql-test/suite/versioning/r/create.result
+2
-2
sql/field.cc
sql/field.cc
+2
-0
sql/field.h
sql/field.h
+3
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+18
-2
No files found.
mysql-test/suite/versioning/r/alter.result
View file @
7a525e7e
...
...
@@ -53,8 +53,8 @@ show create table t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL,
`trx_start` timestamp(6)
NOT NULL
GENERATED ALWAYS AS ROW START,
`trx_end` timestamp(6)
NOT NULL
GENERATED ALWAYS AS ROW END,
`trx_start` timestamp(6) GENERATED ALWAYS AS ROW START,
`trx_end` timestamp(6) GENERATED ALWAYS AS ROW END,
PERIOD FOR SYSTEM_TIME (`trx_start`, `trx_end`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t without system versioning;
...
...
mysql-test/suite/versioning/r/create.result
View file @
7a525e7e
...
...
@@ -9,8 +9,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`XNo` int(10) unsigned DEFAULT NULL,
`Sys_start` timestamp(6)
NOT NULL
GENERATED ALWAYS AS ROW START,
`Sys_end` timestamp(6)
NOT NULL
GENERATED ALWAYS AS ROW END,
`Sys_start` timestamp(6) GENERATED ALWAYS AS ROW START,
`Sys_end` timestamp(6) GENERATED ALWAYS AS ROW END,
PERIOD FOR SYSTEM_TIME (`Sys_start`, `Sys_end`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
# Implicit fields test
...
...
sql/field.cc
View file @
7a525e7e
...
...
@@ -10630,6 +10630,8 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
check_constraint
=
orig_field
?
orig_field
->
check_constraint
:
0
;
option_list
=
old_field
->
option_list
;
pack_flag
=
0
;
versioning
=
VERSIONING_NOT_SET
;
implicit_not_null
=
false
;
switch
(
sql_type
)
{
case
MYSQL_TYPE_BLOB
:
...
...
sql/field.h
View file @
7a525e7e
...
...
@@ -3871,6 +3871,7 @@ class Column_definition: public Sql_alloc
*
check_constraint
;
// Check constraint
enum_column_versioning
versioning
;
bool
implicit_not_null
;
Column_definition
()
:
comment
(
null_lex_str
),
...
...
@@ -3880,7 +3881,8 @@ class Column_definition: public Sql_alloc
srid
(
0
),
geom_type
(
Field
::
GEOM_GEOMETRY
),
option_list
(
NULL
),
pack_flag
(
0
),
vcol_info
(
0
),
default_value
(
0
),
check_constraint
(
0
),
versioning
(
VERSIONING_NOT_SET
)
versioning
(
VERSIONING_NOT_SET
),
implicit_not_null
(
false
)
{
interval_list
.
empty
();
}
...
...
sql/sql_yacc.yy
View file @
7a525e7e
...
...
@@ -6305,6 +6305,11 @@ field_def:
my_yyabort_error((ER_VERS_WRONG_PARAMS, MYF(0), table_name, err));
}
*p= field_name;
if (lex->last_field->implicit_not_null)
{
lex->last_field->flags&= ~NOT_NULL_FLAG;
lex->last_field->implicit_not_null= false;
}
}
;
...
...
@@ -6517,7 +6522,10 @@ field_type:
Unless --explicit-defaults-for-timestamp is given.
*/
if (!opt_explicit_defaults_for_timestamp)
{
Lex->last_field->flags|= NOT_NULL_FLAG;
Lex->last_field->implicit_not_null= true;
}
$$.set(opt_mysql56_temporal_format ? MYSQL_TYPE_TIMESTAMP2
: MYSQL_TYPE_TIMESTAMP, $2);
}
...
...
@@ -6704,7 +6712,11 @@ opt_attribute_list:
;
attribute:
NULL_SYM { Lex->last_field->flags&= ~ NOT_NULL_FLAG; }
NULL_SYM
{
Lex->last_field->flags&= ~ NOT_NULL_FLAG;
Lex->last_field->implicit_not_null= false;
}
| DEFAULT column_default_expr { Lex->last_field->default_value= $2; }
| ON UPDATE_SYM NOW_SYM opt_default_time_precision
{
...
...
@@ -6731,7 +6743,11 @@ attribute:
;
serial_attribute:
not NULL_SYM { Lex->last_field->flags|= NOT_NULL_FLAG; }
not NULL_SYM
{
Lex->last_field->flags|= NOT_NULL_FLAG;
Lex->last_field->implicit_not_null= false;
}
| opt_primary KEY_SYM
{
LEX *lex=Lex;
...
...
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