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
b36f63e3
Commit
b36f63e3
authored
Sep 29, 2005
by
gluh@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
4.1 -> 5.0 merge
parents
36edcbf4
f9762c47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
7 deletions
+41
-7
mysql-test/r/sql_mode.result
mysql-test/r/sql_mode.result
+23
-3
mysql-test/t/sql_mode.test
mysql-test/t/sql_mode.test
+12
-0
sql/sql_show.cc
sql/sql_show.cc
+6
-4
No files found.
mysql-test/r/sql_mode.result
View file @
b36f63e3
...
...
@@ -65,7 +65,7 @@ sql_mode NO_FIELD_OPTIONS,MYSQL323,MYSQL40,HIGH_NOT_PRECEDENCE
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
auto_increment
,
`a` int(11) NOT NULL,
`pseudo` varchar(35) NOT NULL default '',
`email` varchar(60) NOT NULL default '',
PRIMARY KEY (`a`),
...
...
@@ -79,8 +79,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" int(11) NOT NULL,
"pseudo" varchar(35) NOT NULL default '',
"email" varchar(60) NOT NULL default '',
"pseudo" varchar(35)
character set latin2
NOT NULL default '',
"email" varchar(60)
character set latin2
NOT NULL default '',
PRIMARY KEY ("a"),
UNIQUE KEY "email" ("email")
)
...
...
@@ -457,4 +457,24 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VI
create view v2 as select a from t2 where a in (select a from v1);
drop view v2, v1;
drop table t1, t2;
set session sql_mode=ansi;
create table t1
(f1 integer auto_increment primary key,
f2 timestamp default current_timestamp on update current_timestamp);
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"f1" int(11) NOT NULL auto_increment,
"f2" timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY ("f1")
)
set session sql_mode=no_field_options;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`f1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
mysql-test/t/sql_mode.test
View file @
b36f63e3
...
...
@@ -86,6 +86,18 @@ drop table t1 ;
--
error
1231
set
@@
SQL_MODE
=
NULL
;
#
# Bug #797: in sql_mode=ANSI, show create table ignores auto_increment
#
set
session
sql_mode
=
ansi
;
create
table
t1
(
f1
integer
auto_increment
primary
key
,
f2
timestamp
default
current_timestamp
on
update
current_timestamp
);
show
create
table
t1
;
set
session
sql_mode
=
no_field_options
;
show
create
table
t1
;
drop
table
t1
;
# End of 4.1 tests
#
...
...
sql/sql_show.cc
View file @
b36f63e3
...
...
@@ -794,7 +794,8 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
field
->
sql_type
(
type
);
packet
->
append
(
type
.
ptr
(),
type
.
length
(),
system_charset_info
);
if
(
field
->
has_charset
()
&&
!
limited_mysql_mode
&&
!
foreign_db_mode
)
if
(
field
->
has_charset
()
&&
!
(
thd
->
variables
.
sql_mode
&
(
MODE_MYSQL323
|
MODE_MYSQL40
)))
{
if
(
field
->
charset
()
!=
share
->
table_charset
)
{
...
...
@@ -833,7 +834,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
has_default
=
(
field
->
type
()
!=
FIELD_TYPE_BLOB
&&
!
(
field
->
flags
&
NO_DEFAULT_VALUE_FLAG
)
&&
field
->
unireg_check
!=
Field
::
NEXT_NUMBER
&&
!
((
foreign_db_mode
||
limited_mysql_mode
)
&&
!
((
thd
->
variables
.
sql_mode
&
(
MODE_MYSQL323
|
MODE_MYSQL40
)
)
&&
has_now_default
));
if
(
has_default
)
...
...
@@ -863,12 +864,13 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
packet
->
append
(
tmp
);
}
if
(
!
foreign_db_mode
&&
!
limited_mysql_mode
&&
if
(
!
(
thd
->
variables
.
sql_mode
&
MODE_NO_FIELD_OPTIONS
)
&&
table
->
timestamp_field
==
field
&&
field
->
unireg_check
!=
Field
::
TIMESTAMP_DN_FIELD
)
packet
->
append
(
" on update CURRENT_TIMESTAMP"
,
28
);
if
(
field
->
unireg_check
==
Field
::
NEXT_NUMBER
&&
!
foreign_db_mode
)
if
(
field
->
unireg_check
==
Field
::
NEXT_NUMBER
&&
!
(
thd
->
variables
.
sql_mode
&
MODE_NO_FIELD_OPTIONS
))
packet
->
append
(
" auto_increment"
,
15
);
if
(
field
->
comment
.
length
)
...
...
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