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
efc8404a
Commit
efc8404a
authored
Jul 25, 2005
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix (bug #11964: ALTER TABLE gives wrong error message with sql-mode TRADITIONAL (timestamp)).
parent
35b66a40
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
1 deletion
+39
-1
mysql-test/r/strict.result
mysql-test/r/strict.result
+21
-0
mysql-test/t/strict.test
mysql-test/t/strict.test
+14
-0
sql/field.cc
sql/field.cc
+4
-1
No files found.
mysql-test/r/strict.result
View file @
efc8404a
...
@@ -1258,3 +1258,24 @@ select * from t1;
...
@@ -1258,3 +1258,24 @@ select * from t1;
d
d
2000-10-01
2000-10-01
drop table t1;
drop table t1;
set @@sql_mode='traditional';
create table t1(a int, b timestamp);
alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a int, b timestamp default 20050102030405);
alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` timestamp NOT NULL default '2005-01-02 03:04:05',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
mysql-test/t/strict.test
View file @
efc8404a
...
@@ -1118,3 +1118,17 @@ insert into t1 values ('2000-10-01');
...
@@ -1118,3 +1118,17 @@ insert into t1 values ('2000-10-01');
update
t1
set
d
=
1100
;
update
t1
set
d
=
1100
;
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #11964: alter table with timestamp field
#
set
@@
sql_mode
=
'traditional'
;
create
table
t1
(
a
int
,
b
timestamp
);
alter
table
t1
add
primary
key
(
a
);
show
create
table
t1
;
drop
table
t1
;
create
table
t1
(
a
int
,
b
timestamp
default
20050102030405
);
alter
table
t1
add
primary
key
(
a
);
show
create
table
t1
;
drop
table
t1
;
sql/field.cc
View file @
efc8404a
...
@@ -8462,7 +8462,10 @@ create_field::create_field(Field *old_field,Field *orig_field)
...
@@ -8462,7 +8462,10 @@ create_field::create_field(Field *old_field,Field *orig_field)
def
=
0
;
def
=
0
;
if
(
!
(
flags
&
(
NO_DEFAULT_VALUE_FLAG
|
BLOB_FLAG
))
&&
if
(
!
(
flags
&
(
NO_DEFAULT_VALUE_FLAG
|
BLOB_FLAG
))
&&
!
old_field
->
is_real_null
()
&&
!
old_field
->
is_real_null
()
&&
old_field
->
ptr
&&
orig_field
)
old_field
->
ptr
&&
orig_field
&&
(
sql_type
!=
FIELD_TYPE_TIMESTAMP
||
/* set def only if */
old_field
->
table
->
timestamp_field
!=
old_field
||
/* timestamp field */
unireg_check
==
Field
::
TIMESTAMP_UN_FIELD
))
/* has default val */
{
{
char
buff
[
MAX_FIELD_WIDTH
],
*
pos
;
char
buff
[
MAX_FIELD_WIDTH
],
*
pos
;
String
tmp
(
buff
,
sizeof
(
buff
),
charset
),
*
res
;
String
tmp
(
buff
,
sizeof
(
buff
),
charset
),
*
res
;
...
...
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