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
2b921845
Commit
2b921845
authored
Feb 15, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
dcaabf07
e8b6c150
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
145 deletions
+46
-145
mysql-test/main/constraints.result
mysql-test/main/constraints.result
+17
-0
mysql-test/main/constraints.test
mysql-test/main/constraints.test
+20
-0
mysys/my_open.c
mysys/my_open.c
+1
-4
sql/item_func.cc
sql/item_func.cc
+5
-6
storage/connect/mysql-test/connect/r/xml.result
storage/connect/mysql-test/connect/r/xml.result
+1
-1
storage/heap/heapdef.h
storage/heap/heapdef.h
+0
-1
storage/heap/hp_hash.c
storage/heap/hp_hash.c
+2
-133
No files found.
mysql-test/main/constraints.result
View file @
2b921845
...
...
@@ -111,3 +111,20 @@ long_enough_name CREATE TABLE `long_enough_name` (
CONSTRAINT `constr` CHECK (`f6` >= 0)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE long_enough_name;
create table t1 (a int check (a>10)) select 100 as 'a';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL CHECK (`a` > 10)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a text default(length(now())) check (length(a) > 1));
insert into t1 values ();
insert into t1 values ("ccc");
insert into t1 values ("");
ERROR 23000: CONSTRAINT `t1.a` failed for `test`.`t1`
select * from t1;
a
19
ccc
drop table t1;
mysql-test/main/constraints.test
View file @
2b921845
...
...
@@ -102,3 +102,23 @@ SELECT * FROM long_enough_name AS tbl;
SHOW
CREATE
TABLE
long_enough_name
;
DROP
TABLE
long_enough_name
;
#
# Check that we don't loose constraints as part of CREATE ... SELECT
#
create
table
t1
(
a
int
check
(
a
>
10
))
select
100
as
'a'
;
show
create
table
t1
;
drop
table
t1
;
#
# Check that we constraints on field with default expressions work
#
create
table
t1
(
a
text
default
(
length
(
now
()))
check
(
length
(
a
)
>
1
));
insert
into
t1
values
();
insert
into
t1
values
(
"ccc"
);
--
error
ER_CONSTRAINT_FAILED
insert
into
t1
values
(
""
);
select
*
from
t1
;
drop
table
t1
;
mysys/my_open.c
View file @
2b921845
...
...
@@ -89,10 +89,7 @@ int my_close(File fd, myf MyFlags)
my_file_info
[
fd
].
type
=
UNOPEN
;
}
#ifndef _WIN32
do
{
err
=
close
(
fd
);
}
while
(
err
==
-
1
&&
errno
==
EINTR
);
err
=
close
(
fd
);
#else
err
=
my_win_close
(
fd
);
#endif
...
...
sql/item_func.cc
View file @
2b921845
...
...
@@ -6330,17 +6330,17 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
if
(
m_sp
->
agg_type
()
==
GROUP_AGGREGATE
)
{
List
<
Item
>
list
;
list
.
empty
();
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
list
.
push_back
(
*
(
args
+
i
));
Item_sum_sp
*
item_sp
;
Query_arena
*
arena
,
backup
;
arena
=
thd
->
activate_stmt_arena_if_needed
(
&
backup
);
if
(
arg_count
)
{
List
<
Item
>
list
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
list
.
push_back
(
args
[
i
]);
item_sp
=
new
(
thd
->
mem_root
)
Item_sum_sp
(
thd
,
context
,
m_name
,
sp
,
list
);
}
else
item_sp
=
new
(
thd
->
mem_root
)
Item_sum_sp
(
thd
,
context
,
m_name
,
sp
);
...
...
@@ -6354,7 +6354,6 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
if
(
err
)
DBUG_RETURN
(
TRUE
);
list
.
empty
();
DBUG_RETURN
(
FALSE
);
}
...
...
storage/connect/mysql-test/connect/r/xml.result
View file @
2b921845
...
...
@@ -323,7 +323,7 @@ HEX(c) 3F3F3F3F3F3F3F
Warnings:
Level Warning
Code 1366
Message Incorrect string value: '\xC3\x81\xC3\x82\xC3\x83...' for column
'c'
at row 1
Message Incorrect string value: '\xC3\x81\xC3\x82\xC3\x83...' for column
`test`.`t1`.`c`
at row 1
Level Warning
Code 1105
Message Out of range value ÁÂÃÄÅÆÇ for column 'c' at row 1
...
...
storage/heap/heapdef.h
View file @
2b921845
...
...
@@ -81,7 +81,6 @@ extern uchar *hp_search(HP_INFO *info,HP_KEYDEF *keyinfo,const uchar *key,
uint
nextflag
);
extern
uchar
*
hp_search_next
(
HP_INFO
*
info
,
HP_KEYDEF
*
keyinfo
,
const
uchar
*
key
,
HASH_INFO
*
pos
);
extern
ulong
hp_hashnr
(
HP_KEYDEF
*
keyinfo
,
const
uchar
*
key
);
extern
ulong
hp_rec_hashnr
(
HP_KEYDEF
*
keyinfo
,
const
uchar
*
rec
);
extern
void
hp_movelink
(
HASH_INFO
*
pos
,
HASH_INFO
*
next_link
,
HASH_INFO
*
newlink
);
...
...
storage/heap/hp_hash.c
View file @
2b921845
...
...
@@ -19,6 +19,7 @@
#include "heapdef.h"
#include <m_ctype.h>
static
ulong
hp_hashnr
(
HP_KEYDEF
*
keydef
,
const
uchar
*
key
);
/*
Find out how many rows there is in the given range
...
...
@@ -209,11 +210,9 @@ void hp_movelink(HASH_INFO *pos, HASH_INFO *next_link, HASH_INFO *newlink)
return
;
}
#ifndef NEW_HASH_FUNCTION
/* Calc hashvalue for a key */
ulong
hp_hashnr
(
register
HP_KEYDEF
*
keydef
,
register
const
uchar
*
key
)
static
ulong
hp_hashnr
(
HP_KEYDEF
*
keydef
,
const
uchar
*
key
)
{
/*register*/
ulong
nr
=
1
,
nr2
=
4
;
...
...
@@ -350,136 +349,6 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
return
(
nr
);
}
#else
/*
* Fowler/Noll/Vo hash
*
* The basis of the hash algorithm was taken from an idea sent by email to the
* IEEE Posix P1003.2 mailing list from Phong Vo (kpv@research.att.com) and
* Glenn Fowler (gsf@research.att.com). Landon Curt Noll (chongo@toad.com)
* later improved on their algorithm.
*
* The magic is in the interesting relationship between the special prime
* 16777619 (2^24 + 403) and 2^32 and 2^8.
*
* This hash produces the fewest collisions of any function that we've seen so
* far, and works well on both numbers and strings.
*/
ulong
hp_hashnr
(
register
HP_KEYDEF
*
keydef
,
register
const
uchar
*
key
)
{
/*
Note, if a key consists of a combination of numeric and
a text columns, it most likely won't work well.
Making text columns work with NEW_HASH_FUNCTION
needs also changes in strings/ctype-xxx.c.
*/
ulong
nr
=
1
,
nr2
=
4
;
HA_KEYSEG
*
seg
,
*
endseg
;
for
(
seg
=
keydef
->
seg
,
endseg
=
seg
+
keydef
->
keysegs
;
seg
<
endseg
;
seg
++
)
{
uchar
*
pos
=
(
uchar
*
)
key
;
key
+=
seg
->
length
;
if
(
seg
->
null_bit
)
{
key
++
;
if
(
*
pos
)
{
nr
^=
(
nr
<<
1
)
|
1
;
/* Add key pack length (2) to key for VARCHAR segments */
if
(
seg
->
type
==
HA_KEYTYPE_VARTEXT1
)
key
+=
2
;
continue
;
}
pos
++
;
}
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
{
seg
->
charset
->
coll
->
hash_sort
(
seg
->
charset
,
pos
,
((
uchar
*
)
key
)
-
pos
,
&
nr
,
&
nr2
);
}
else
if
(
seg
->
type
==
HA_KEYTYPE_VARTEXT1
)
/* Any VARCHAR segments */
{
uint
pack_length
=
2
;
/* Key packing is constant */
uint
length
=
uint2korr
(
pos
);
seg
->
charset
->
coll
->
hash_sort
(
seg
->
charset
,
pos
+
pack_length
,
length
,
&
nr
,
&
nr2
);
key
+=
pack_length
;
}
else
{
for
(
;
pos
<
(
uchar
*
)
key
;
pos
++
)
{
nr
*=
16777619
;
nr
^=
(
uint
)
*
pos
;
}
}
}
#ifdef ONLY_FOR_HASH_DEBUGGING
DBUG_PRINT
(
"exit"
,
(
"hash: 0x%lx"
,
nr
));
#endif
return
(
nr
);
}
/* Calc hashvalue for a key in a record */
ulong
hp_rec_hashnr
(
register
HP_KEYDEF
*
keydef
,
register
const
uchar
*
rec
)
{
ulong
nr
=
1
,
nr2
=
4
;
HA_KEYSEG
*
seg
,
*
endseg
;
for
(
seg
=
keydef
->
seg
,
endseg
=
seg
+
keydef
->
keysegs
;
seg
<
endseg
;
seg
++
)
{
uchar
*
pos
=
(
uchar
*
)
rec
+
seg
->
start
;
if
(
seg
->
null_bit
)
{
if
(
rec
[
seg
->
null_pos
]
&
seg
->
null_bit
)
{
nr
^=
(
nr
<<
1
)
|
1
;
continue
;
}
}
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
{
uint
char_length
=
seg
->
length
;
/* TODO: fix to use my_charpos() */
seg
->
charset
->
coll
->
hash_sort
(
seg
->
charset
,
pos
,
char_length
,
&
nr
,
&
nr2
);
}
else
if
(
seg
->
type
==
HA_KEYTYPE_VARTEXT1
)
/* Any VARCHAR segments */
{
uint
pack_length
=
seg
->
bit_start
;
uint
length
=
(
pack_length
==
1
?
(
uint
)
*
(
uchar
*
)
pos
:
uint2korr
(
pos
));
seg
->
charset
->
coll
->
hash_sort
(
seg
->
charset
,
pos
+
pack_length
,
length
,
&
nr
,
&
nr2
);
}
else
{
uchar
*
end
=
pos
+
seg
->
length
;
if
(
seg
->
type
==
HA_KEYTYPE_BIT
&&
seg
->
bit_length
)
{
uchar
bits
=
get_rec_bits
(
rec
+
seg
->
bit_pos
,
seg
->
bit_start
,
seg
->
bit_length
);
nr
*=
16777619
;
nr
^=
(
uint
)
bits
;
end
--
;
}
for
(
;
pos
<
end
;
pos
++
)
{
nr
*=
16777619
;
nr
^=
(
uint
)
*
pos
;
}
}
}
#ifdef ONLY_FOR_HASH_DEBUGGING
DBUG_PRINT
(
"exit"
,
(
"hash: 0x%lx"
,
nr
));
#endif
return
(
nr
);
}
#endif
/*
Compare keys for two records. Returns 0 if they are identical
...
...
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