File: func_weight_string.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (203 lines) | stat: -rw-r--r-- 7,996 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
drop table if exists t1;
set names latin1;
select hex(weight_string(0x010203));
hex(weight_string(0x010203))
010203
select hex(weight_string('aa' as char(3)));
hex(weight_string('aa' as char(3)))
414120
select hex(weight_string('a' as char(-1)));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1)))' at line 1
select hex(weight_string('a' as char(0)));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0)))' at line 1
select hex(weight_string('a' as char(1)));
hex(weight_string('a' as char(1)))
41
select hex(weight_string('ab' as char(1)));
hex(weight_string('ab' as char(1)))
41
select hex(weight_string('ab'));
hex(weight_string('ab'))
4142
select hex(weight_string('aa' as binary(3)));
hex(weight_string('aa' as binary(3)))
616100
select hex(weight_string(cast('aa' as binary(3))));
hex(weight_string(cast('aa' as binary(3))))
616100
create table t1 charset latin1 select weight_string('test') as w;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `w` varbinary(8) DEFAULT NULL
) ENGINE=ENGINE DEFAULT CHARSET=latin1
drop table t1;
create table t1 charset latin1 select weight_string(repeat('t',66000)) as w;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `w` longblob
) ENGINE=ENGINE DEFAULT CHARSET=latin1
drop table t1;
select weight_string(NULL);
weight_string(NULL)
NULL
select 1 as weight_string, 2 as reverse;
weight_string	reverse
1	2
select coercibility(weight_string('test'));
coercibility(weight_string('test'))
4
select coercibility(weight_string('test' collate latin1_swedish_ci));
coercibility(weight_string('test' collate latin1_swedish_ci))
0
create table t1 (s1 varchar(5)) charset latin1;
insert into t1 values ('a'),(null);
select hex(weight_string(s1)) from t1 order by s1;
hex(weight_string(s1))
NULL
41
drop table t1;
#
# BUG#11898467 - SERVER CRASHES ON SELECT HEX(WEIGHT_STRING(STR AS [CHAR|BINARY](N))) IF N IS BIG 
#
SET GLOBAL max_allowed_packet=1024;
Warnings:
Warning	1708	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT HEX(WEIGHT_STRING('ab' AS CHAR(1000000)));
HEX(WEIGHT_STRING('ab' AS CHAR(1000000)))
NULL
Warnings:
Warning	1301	Result of weight_string() was larger than max_allowed_packet (1024) - truncated
SELECT HEX(WEIGHT_STRING('ab' AS BINARY(1000000)));
HEX(WEIGHT_STRING('ab' AS BINARY(1000000)))
NULL
Warnings:
Warning	1301	Result of cast_as_binary() was larger than max_allowed_packet (1024) - truncated
SET GLOBAL max_allowed_packet=default;
#
# BUG#21974321: WEIGHT_STRING RESULT IS WRONG IF USED IN A
#               VIEW (AS CHAR CLAUSE IS LOST)
#
SET NAMES utf8;
Warnings:
Warning	3719	'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
SET collation_connection=utf16_unicode_ci;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin2 COLLATE latin2_czech_cs);
INSERT INTO t1 VALUES ('abcd');
INSERT INTO t1 VALUES ('dcba');
CREATE VIEW v1 AS SELECT WEIGHT_STRING(_latin1 'ab') AS b;
CREATE VIEW v5 AS SELECT WEIGHT_STRING(a AS BINARY(2)) AS b FROM t1;
CREATE VIEW v6 AS SELECT WEIGHT_STRING(a AS BINARY(6)) AS b FROM t1;
SHOW CREATE VIEW v1;
View	Create View	character_set_client	collation_connection
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select weight_string(_latin1'ab') AS `b`	utf8mb3	utf16_unicode_ci
SHOW CREATE VIEW v5;
View	Create View	character_set_client	collation_connection
v5	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v5` AS select weight_string(cast(`t1`.`a` as char(2) charset binary)) AS `b` from `t1`	utf8mb3	utf16_unicode_ci
SHOW CREATE VIEW v6;
View	Create View	character_set_client	collation_connection
v6	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select weight_string(cast(`t1`.`a` as char(6) charset binary)) AS `b` from `t1`	utf8mb3	utf16_unicode_ci
DROP VIEW v1;
DROP VIEW v5;
DROP VIEW v6;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10)) charset latin1;
INSERT INTO t1 VALUES ('abcd');
INSERT INTO t1 VALUES ('dcba');
CREATE VIEW v1 AS SELECT WEIGHT_STRING(_latin1 'ab') AS b;
CREATE VIEW v2 AS SELECT WEIGHT_STRING(a) AS b FROM t1;
CREATE VIEW v3 AS SELECT WEIGHT_STRING(a AS CHAR(2)) AS b FROM t1;
CREATE VIEW v4 AS SELECT WEIGHT_STRING(a AS CHAR(6)) AS b FROM t1;
CREATE VIEW v5 AS SELECT WEIGHT_STRING(a AS BINARY(2)) AS b FROM t1;
CREATE VIEW v6 AS SELECT WEIGHT_STRING(a AS BINARY(6)) AS b FROM t1;
SHOW CREATE VIEW v1;
View	Create View	character_set_client	collation_connection
v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select weight_string(_latin1'ab') AS `b`	utf8mb3	utf16_unicode_ci
SHOW CREATE VIEW v2;
View	Create View	character_set_client	collation_connection
v2	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select weight_string(`t1`.`a`) AS `b` from `t1`	utf8mb3	utf16_unicode_ci
SHOW CREATE VIEW v3;
View	Create View	character_set_client	collation_connection
v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select weight_string(`t1`.`a` as char(2)) AS `b` from `t1`	utf8mb3	utf16_unicode_ci
SHOW CREATE VIEW v4;
View	Create View	character_set_client	collation_connection
v4	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select weight_string(`t1`.`a` as char(6)) AS `b` from `t1`	utf8mb3	utf16_unicode_ci
SHOW CREATE VIEW v5;
View	Create View	character_set_client	collation_connection
v5	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v5` AS select weight_string(cast(`t1`.`a` as char(2) charset binary)) AS `b` from `t1`	utf8mb3	utf16_unicode_ci
SHOW CREATE VIEW v6;
View	Create View	character_set_client	collation_connection
v6	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select weight_string(cast(`t1`.`a` as char(6) charset binary)) AS `b` from `t1`	utf8mb3	utf16_unicode_ci
SELECT HEX(b) FROM v1;
HEX(b)
4142
SELECT HEX(WEIGHT_STRING(_latin1 'ab'));
HEX(WEIGHT_STRING(_latin1 'ab'))
4142
SELECT HEX(b) FROM v2;
HEX(b)
41424344
44434241
SELECT HEX(b) FROM v3;
HEX(b)
4142
4443
SELECT HEX(b) FROM v4;
HEX(b)
414243442020
444342412020
SELECT HEX(b) FROM v5;
HEX(b)
6162
6463
Warnings:
Warning	1292	Truncated incorrect BINARY(2) value: 'abcd'
Warning	1292	Truncated incorrect BINARY(2) value: 'dcba'
SELECT HEX(WEIGHT_STRING(a AS BINARY(2))) FROM t1;
HEX(WEIGHT_STRING(a AS BINARY(2)))
6162
6463
Warnings:
Warning	1292	Truncated incorrect BINARY(2) value: 'abcd'
Warning	1292	Truncated incorrect BINARY(2) value: 'dcba'
SELECT HEX(b) FROM v6;
HEX(b)
616263640000
646362610000
SELECT HEX(WEIGHT_STRING(a AS BINARY(6))) FROM t1;
HEX(WEIGHT_STRING(a AS BINARY(6)))
616263640000
646362610000
DROP VIEW v1;
DROP VIEW v2;
DROP VIEW v3;
DROP VIEW v4;
DROP VIEW v5;
DROP VIEW v6;
DROP TABLE t1;
#
# BUG#27752619: ASSERTION FAILED: SRC WEIGHT_STRING IN
#               MY_STRNXFRM_UNICODE_FULL_BIN
#
SELECT HEX(WEIGHT_STRING(JSON_UNQUOTE(JSON_SET('{}','$',''))));
HEX(WEIGHT_STRING(JSON_UNQUOTE(JSON_SET('{}','$',''))))

#
# Bug #30898753: DISTINCT(HEX(WEIGHT_STRING(CH))) CUT RESULT OFF
#
CREATE TABLE t1 ( ch VARCHAR(1) COLLATE latin2_czech_cs );
INSERT INTO t1 VALUES (0x4F);
SELECT DISTINCT HEX(WEIGHT_STRING(ch)) FROM t1;
HEX(WEIGHT_STRING(ch))
140127014D014D00
DROP TABLE t1;
#
# Bug #32744772 REGRESSION: TRIM CRASHES IN STRING::LENGTH
#
SET NAMES DEFAULT;
DO ltrim(weight_string(1));
ERROR HY000: Cannot convert string '\x80\x00\x00\x00\x00\x00...' from binary to utf8mb4
DO rtrim(weight_string(1));
ERROR HY000: Cannot convert string '\x80\x00\x00\x00\x00\x00...' from binary to utf8mb4
SET NAMES latin1;