Merge lp:~posulliv/drizzle/bug337038-dec-trunc-should-error into lp:~drizzle-trunk/drizzle/development
- bug337038-dec-trunc-should-error
- Merge into development
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~posulliv/drizzle/bug337038-dec-trunc-should-error | ||||
Merge into: | lp:~drizzle-trunk/drizzle/development | ||||
Diff against target: | None lines | ||||
To merge this branch: | bzr merge lp:~posulliv/drizzle/bug337038-dec-trunc-should-error | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jay Pipes (community) | Approve | ||
Review via email: mp+5093@code.launchpad.net |
Commit message
Description of the change
Padraig O'Sullivan (posulliv) wrote : | # |
Jay Pipes (jaypipes) wrote : | # |
The patch looks good, but I'd like to see some more documentation in the test cases for decimal. Padraig, do you think you could:
a) Separate out the multi-value INSERT statements in the test case into single INSERT statements? This makes it easy to track down which, if any, of the VALUES may trigger a warning or error.
b) Put a comment above each SELECT and INSERT you modified in the test case to indicate *why* that specific value was used in the test case. As it is now, numbers seem to be fairly randomly chosen. Would be good to see the test case be more explicit about the edge cases it intends to validate...
Other than that, everything looks great. :)
-jay
- 975. By Padraig O'Sullivan
-
Added extra comments to parts of test cases that were modified for this bug
fix based on Jay's review comments. Also split multi-value INSERT statements
into single INSERT statements.
Padraig O'Sullivan (posulliv) wrote : | # |
Thanks for the comments Jay. I just pushed my changes to the branch where I took your comments into consideration. I separated multi-value INSERT statements into single INSERT statements and tried to add comments where I could. All of the numbers were already present in the test case before I started on this bug fix so I tried to add appropriate comments where possible. Let me know if you think I should add more comments or anything else.
-Padraig
Jay Pipes (jaypipes) wrote : | # |
Hi Padraig! Sorry to disapprove again, but this worries me:
110 -10.56
111 +10.55
112 NULL
113 -10.55
114 --10.56
115 -11.00
116 -10.00
117 -10.55
118 -10.56
119 --10.55
120 --10.56
121 -11.00
122 -10.00
123 -2.00
124 +-10.55
125 +11.00
126 +10.00
127 +10.55
128 +10.55
129 +-10.55
130 +-10.55
131 +11.00
132 +10.00
133 +99.99
When I see test case results go from one value to another, I check very carefully to ensure that the patch didn't break something accidentally. In this case, I see that one row (line 123 in the diff output) went from 2.00 to 99.99 (line 133). Is this correct? Or is there a fault in either our test case or the original one?
Cheers!
jay
p.s. Yeah, I know this is annoying work...sorry!
Jay Pipes (jaypipes) wrote : | # |
Approved after speaking with Padraig on IRC. The 2.00 -> 99.00 change is a separate row in the result set, and error checking is not done on insertion into a temporary table currently.
Preview Diff
1 | === modified file 'drizzled/field.cc' |
2 | --- drizzled/field.cc 2009-03-03 09:40:55 +0000 |
3 | +++ drizzled/field.cc 2009-04-01 01:27:08 +0000 |
4 | @@ -763,9 +763,10 @@ |
5 | @param op_result decimal library return code (E_DEC_* see include/decimal.h) |
6 | |
7 | @retval |
8 | - 1 there was overflow |
9 | + E_DEC_OVERFLOW there was overflow |
10 | + E_DEC_TRUNCATED there was truncation |
11 | @retval |
12 | - 0 no error or some other errors except overflow |
13 | + 0 no error or there was some other error except overflow or truncation |
14 | */ |
15 | |
16 | int Field::warn_if_overflow(int op_result) |
17 | @@ -773,12 +774,12 @@ |
18 | if (op_result == E_DEC_OVERFLOW) |
19 | { |
20 | set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); |
21 | - return 1; |
22 | + return E_DEC_OVERFLOW; |
23 | } |
24 | if (op_result == E_DEC_TRUNCATED) |
25 | { |
26 | - set_warning(DRIZZLE_ERROR::WARN_LEVEL_NOTE, ER_WARN_DATA_TRUNCATED, 1); |
27 | - /* We return 0 here as this is not a critical issue */ |
28 | + set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1); |
29 | + return E_DEC_TRUNCATED; |
30 | } |
31 | return 0; |
32 | } |
33 | |
34 | === modified file 'drizzled/field/decimal.cc' |
35 | --- drizzled/field/decimal.cc 2009-03-18 00:29:24 +0000 |
36 | +++ drizzled/field/decimal.cc 2009-04-01 02:59:07 +0000 |
37 | @@ -149,7 +149,8 @@ |
38 | |
39 | switch (err) { |
40 | case E_DEC_TRUNCATED: |
41 | - set_warning(DRIZZLE_ERROR::WARN_LEVEL_NOTE, ER_WARN_DATA_TRUNCATED, 1); |
42 | + set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1); |
43 | + set_value_on_overflow(&decimal_value, decimal_value.sign()); |
44 | break; |
45 | case E_DEC_OVERFLOW: |
46 | set_warning(DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1); |
47 | |
48 | === modified file 'tests/r/func_group.result' |
49 | --- tests/r/func_group.result 2009-02-17 10:00:38 +0000 |
50 | +++ tests/r/func_group.result 2009-04-01 02:59:07 +0000 |
51 | @@ -873,22 +873,20 @@ |
52 | 3.00000 1 |
53 | SELECT b/c as v, SUM(a) FROM t1 GROUP BY v; |
54 | v SUM(a) |
55 | -0.33333 6 |
56 | 0.50000 6 |
57 | -0.66667 6 |
58 | 1.00000 18 |
59 | 1.50000 6 |
60 | 2.00000 6 |
61 | 3.00000 6 |
62 | +9999999999.99999 12 |
63 | SELECT SUM(a) FROM t1 GROUP BY b/c; |
64 | SUM(a) |
65 | 6 |
66 | -6 |
67 | -6 |
68 | 18 |
69 | 6 |
70 | 6 |
71 | 6 |
72 | +12 |
73 | DROP TABLE t1; |
74 | set div_precision_increment= @sav_dpi; |
75 | CREATE TABLE t1 (a INT PRIMARY KEY, b INT); |
76 | |
77 | === modified file 'tests/r/strict.result' |
78 | --- tests/r/strict.result 2009-03-16 15:20:27 +0000 |
79 | +++ tests/r/strict.result 2009-04-01 03:10:33 +0000 |
80 | @@ -121,14 +121,8 @@ |
81 | 9223372036854775807 |
82 | DROP TABLE t1; |
83 | CREATE TABLE t1 (col1 NUMERIC(4,2)); |
84 | -INSERT INTO t1 VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01); |
85 | -Warnings: |
86 | -Note 1265 Data truncated for column 'col1' at row 2 |
87 | -Note 1265 Data truncated for column 'col1' at row 5 |
88 | -INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+01'); |
89 | -Warnings: |
90 | -Note 1265 Data truncated for column 'col1' at row 2 |
91 | -Note 1265 Data truncated for column 'col1' at row 4 |
92 | +INSERT INTO t1 VALUES (10.55),(10.55),(0),(-10.55),(-10.55),(11),(1e+01); |
93 | +INSERT INTO t1 VALUES ('10.55'),('10.55'),('-10.55'),('-10.55'),('11'),('1e+01'); |
94 | INSERT INTO t1 VALUES (101.55); |
95 | ERROR 22003: Out of range value for column 'col1' at row 1 |
96 | INSERT INTO t1 VALUES (101); |
97 | @@ -165,7 +159,7 @@ |
98 | ERROR HY000: Incorrect decimal value: '1a' for column 'col1' at row 1 |
99 | INSERT IGNORE INTO t1 (col1) VALUES ('2a'); |
100 | Warnings: |
101 | -Note 1265 Data truncated for column 'col1' at row 1 |
102 | +Warning 1265 Data truncated for column 'col1' at row 1 |
103 | INSERT IGNORE INTO t1 values (1/0); |
104 | Warnings: |
105 | Error 1365 Division by 0 |
106 | @@ -185,19 +179,19 @@ |
107 | SELECT * FROM t1; |
108 | col1 |
109 | 10.55 |
110 | -10.56 |
111 | +10.55 |
112 | NULL |
113 | -10.55 |
114 | --10.56 |
115 | -11.00 |
116 | -10.00 |
117 | -10.55 |
118 | -10.56 |
119 | --10.55 |
120 | --10.56 |
121 | -11.00 |
122 | -10.00 |
123 | -2.00 |
124 | +-10.55 |
125 | +11.00 |
126 | +10.00 |
127 | +10.55 |
128 | +10.55 |
129 | +-10.55 |
130 | +-10.55 |
131 | +11.00 |
132 | +10.00 |
133 | +99.99 |
134 | NULL |
135 | 99.99 |
136 | -99.99 |
137 | |
138 | === modified file 'tests/r/type_decimal.result' |
139 | --- tests/r/type_decimal.result 2009-02-18 19:27:32 +0000 |
140 | +++ tests/r/type_decimal.result 2009-04-01 01:27:08 +0000 |
141 | @@ -214,8 +214,7 @@ |
142 | insert into t1 values (1e+100),(1e-100),(-1e+100); |
143 | ERROR 22003: Out of range value for column 'a' at row 1 |
144 | insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0); |
145 | -Warnings: |
146 | -Note 1265 Data truncated for column 'a' at row 3 |
147 | +ERROR 01000: Data truncated for column 'a' at row 3 |
148 | insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 "); |
149 | select * from t1; |
150 | a |
151 | @@ -231,11 +230,6 @@ |
152 | 1.00 |
153 | 1.00 |
154 | -1.00 |
155 | -123.40 |
156 | -12340.00 |
157 | -1.23 |
158 | -1230.00 |
159 | -123.00 |
160 | 98.00 |
161 | 987.00 |
162 | 98760.00 |
163 | @@ -301,17 +295,6 @@ |
164 | select * from t1; |
165 | a |
166 | drop table t1; |
167 | -create table t1(a decimal(10,5), b decimal(10,1)); |
168 | -insert into t1 values(123.12345, 123.12345); |
169 | -Warnings: |
170 | -Note 1265 Data truncated for column 'b' at row 1 |
171 | -update t1 set b=a; |
172 | -Warnings: |
173 | -Note 1265 Data truncated for column 'b' at row 1 |
174 | -select * from t1; |
175 | -a b |
176 | -123.12345 123.1 |
177 | -drop table t1; |
178 | End of 4.1 tests |
179 | CREATE TABLE t1 |
180 | (EMPNUM CHAR(3) NOT NULL, |
181 | @@ -509,8 +492,7 @@ |
182 | 123456.000000000000000000000000000000 |
183 | delete from t1; |
184 | INSERT INTO t1 VALUES (1234567890, 20), (999.99, 5); |
185 | -Warnings: |
186 | -Note 1265 Data truncated for column 'a' at row 2 |
187 | +ERROR 01000: Data truncated for column 'a' at row 2 |
188 | show create table t1; |
189 | Table Create Table |
190 | t1 CREATE TABLE `t1` ( |
191 | @@ -519,8 +501,6 @@ |
192 | ) ENGINE=InnoDB |
193 | select round(a,b) as c from t1 order by c; |
194 | c |
195 | -1000 |
196 | -1234567890 |
197 | DROP TABLE t1, t2, t3, t4; |
198 | CREATE TABLE t1( a DECIMAL(4, 3), b INT ); |
199 | INSERT INTO t1 VALUES ( 1, 5 ), ( 2, 4 ), ( 3, 3 ), ( 4, 2 ), ( 5, 1 ); |
200 | |
201 | === modified file 'tests/r/type_newdecimal.result' |
202 | --- tests/r/type_newdecimal.result 2009-03-11 06:37:19 +0000 |
203 | +++ tests/r/type_newdecimal.result 2009-04-01 01:27:08 +0000 |
204 | @@ -135,193 +135,6 @@ |
205 | NULL |
206 | Warnings: |
207 | Error 1365 Division by 0 |
208 | -create table wl1612 (col1 int, col2 decimal(38,10), col3 numeric(38,10)); |
209 | -insert into wl1612 values(1,12345678901234567890.1234567890,12345678901234567890.1234567890); |
210 | -select * from wl1612; |
211 | -col1 col2 col3 |
212 | -1 12345678901234567890.1234567890 12345678901234567890.1234567890 |
213 | -insert into wl1612 values(2,01234567890123456789.0123456789,01234567890123456789.0123456789); |
214 | -select * from wl1612 where col1=2; |
215 | -col1 col2 col3 |
216 | -2 1234567890123456789.0123456789 1234567890123456789.0123456789 |
217 | -insert into wl1612 values(3,1234567890123456789012345678.0123456789,1234567890123456789012345678.0123456789); |
218 | -select * from wl1612 where col1=3; |
219 | -col1 col2 col3 |
220 | -3 1234567890123456789012345678.0123456789 1234567890123456789012345678.0123456789 |
221 | -select col1/0 from wl1612; |
222 | -col1/0 |
223 | -NULL |
224 | -NULL |
225 | -NULL |
226 | -Warnings: |
227 | -Error 1365 Division by 0 |
228 | -Error 1365 Division by 0 |
229 | -Error 1365 Division by 0 |
230 | -select col2/0 from wl1612; |
231 | -col2/0 |
232 | -NULL |
233 | -NULL |
234 | -NULL |
235 | -Warnings: |
236 | -Error 1365 Division by 0 |
237 | -Error 1365 Division by 0 |
238 | -Error 1365 Division by 0 |
239 | -select col3/0 from wl1612; |
240 | -col3/0 |
241 | -NULL |
242 | -NULL |
243 | -NULL |
244 | -Warnings: |
245 | -Error 1365 Division by 0 |
246 | -Error 1365 Division by 0 |
247 | -Error 1365 Division by 0 |
248 | -insert into wl1612 values(5,5000.0005,5000.0005); |
249 | -insert into wl1612 values(6,5000.0005,5000.0005); |
250 | -select sum(col2),sum(col3) from wl1612; |
251 | -sum(col2) sum(col3) |
252 | -1234567903703703580370380357.1491481468 1234567903703703580370380357.1491481468 |
253 | -insert into wl1612 values(7,500000.000005,500000.000005); |
254 | -insert into wl1612 values(8,500000.000005,500000.000005); |
255 | -select sum(col2),sum(col3) from wl1612 where col1>4; |
256 | -sum(col2) sum(col3) |
257 | -1010000.0010100000 1010000.0010100000 |
258 | -insert into wl1612 (col1, col2) values(9,1.01234567891); |
259 | -Warnings: |
260 | -Note 1265 Data truncated for column 'col2' at row 1 |
261 | -insert into wl1612 (col1, col2) values(10,1.01234567894); |
262 | -Warnings: |
263 | -Note 1265 Data truncated for column 'col2' at row 1 |
264 | -insert into wl1612 (col1, col2) values(11,1.01234567895); |
265 | -Warnings: |
266 | -Note 1265 Data truncated for column 'col2' at row 1 |
267 | -insert into wl1612 (col1, col2) values(12,1.01234567896); |
268 | -Warnings: |
269 | -Note 1265 Data truncated for column 'col2' at row 1 |
270 | -select col1,col2 from wl1612 where col1>8; |
271 | -col1 col2 |
272 | -9 1.0123456789 |
273 | -10 1.0123456789 |
274 | -11 1.0123456790 |
275 | -12 1.0123456790 |
276 | -insert into wl1612 (col1, col3) values(13,1.01234567891); |
277 | -Warnings: |
278 | -Note 1265 Data truncated for column 'col3' at row 1 |
279 | -insert into wl1612 (col1, col3) values(14,1.01234567894); |
280 | -Warnings: |
281 | -Note 1265 Data truncated for column 'col3' at row 1 |
282 | -insert into wl1612 (col1, col3) values(15,1.01234567895); |
283 | -Warnings: |
284 | -Note 1265 Data truncated for column 'col3' at row 1 |
285 | -insert into wl1612 (col1, col3) values(16,1.01234567896); |
286 | -Warnings: |
287 | -Note 1265 Data truncated for column 'col3' at row 1 |
288 | -select col1,col3 from wl1612 where col1>12; |
289 | -col1 col3 |
290 | -13 1.0123456789 |
291 | -14 1.0123456789 |
292 | -15 1.0123456790 |
293 | -16 1.0123456790 |
294 | -select col1 from wl1612 where col1>4 and col2=1.01234567891; |
295 | -col1 |
296 | -select col1 from wl1612 where col1>4 and col2=1.0123456789; |
297 | -col1 |
298 | -9 |
299 | -10 |
300 | -select col1 from wl1612 where col1>4 and col2<>1.0123456789; |
301 | -col1 |
302 | -5 |
303 | -6 |
304 | -7 |
305 | -8 |
306 | -11 |
307 | -12 |
308 | -select col1 from wl1612 where col1>4 and col2<1.0123456789; |
309 | -col1 |
310 | -select col1 from wl1612 where col1>4 and col2<=1.0123456789; |
311 | -col1 |
312 | -9 |
313 | -10 |
314 | -select col1 from wl1612 where col1>4 and col2>1.0123456789; |
315 | -col1 |
316 | -5 |
317 | -6 |
318 | -7 |
319 | -8 |
320 | -11 |
321 | -12 |
322 | -select col1 from wl1612 where col1>4 and col2>=1.0123456789; |
323 | -col1 |
324 | -5 |
325 | -6 |
326 | -7 |
327 | -8 |
328 | -9 |
329 | -10 |
330 | -11 |
331 | -12 |
332 | -select col1 from wl1612 where col1>4 and col2=1.012345679; |
333 | -col1 |
334 | -11 |
335 | -12 |
336 | -select col1 from wl1612 where col1>4 and col2<>1.012345679; |
337 | -col1 |
338 | -5 |
339 | -6 |
340 | -7 |
341 | -8 |
342 | -9 |
343 | -10 |
344 | -select col1 from wl1612 where col1>4 and col3=1.01234567891; |
345 | -col1 |
346 | -select col1 from wl1612 where col1>4 and col3=1.0123456789; |
347 | -col1 |
348 | -13 |
349 | -14 |
350 | -select col1 from wl1612 where col1>4 and col3<>1.0123456789; |
351 | -col1 |
352 | -5 |
353 | -6 |
354 | -7 |
355 | -8 |
356 | -15 |
357 | -16 |
358 | -select col1 from wl1612 where col1>4 and col3<1.0123456789; |
359 | -col1 |
360 | -select col1 from wl1612 where col1>4 and col3<=1.0123456789; |
361 | -col1 |
362 | -13 |
363 | -14 |
364 | -select col1 from wl1612 where col1>4 and col3>1.0123456789; |
365 | -col1 |
366 | -5 |
367 | -6 |
368 | -7 |
369 | -8 |
370 | -15 |
371 | -16 |
372 | -select col1 from wl1612 where col1>4 and col3>=1.0123456789; |
373 | -col1 |
374 | -5 |
375 | -6 |
376 | -7 |
377 | -8 |
378 | -13 |
379 | -14 |
380 | -15 |
381 | -16 |
382 | -select col1 from wl1612 where col1>4 and col3=1.012345679; |
383 | -col1 |
384 | -15 |
385 | -16 |
386 | -select col1 from wl1612 where col1>4 and col3<>1.012345679; |
387 | -col1 |
388 | -5 |
389 | -6 |
390 | -7 |
391 | -8 |
392 | -13 |
393 | -14 |
394 | -drop table wl1612; |
395 | select 1/3; |
396 | 1/3 |
397 | 0.3333 |
398 | @@ -744,12 +557,10 @@ |
399 | CREATE TABLE Sow6_2f (col1 NUMERIC(4,2)); |
400 | INSERT INTO Sow6_2f VALUES (10.55); |
401 | INSERT INTO Sow6_2f VALUES (10.5555); |
402 | -Warnings: |
403 | -Note 1265 Data truncated for column 'col1' at row 1 |
404 | +ERROR 01000: Data truncated for column 'col1' at row 1 |
405 | INSERT INTO Sow6_2f VALUES (-10.55); |
406 | INSERT INTO Sow6_2f VALUES (-10.5555); |
407 | -Warnings: |
408 | -Note 1265 Data truncated for column 'col1' at row 1 |
409 | +ERROR 01000: Data truncated for column 'col1' at row 1 |
410 | INSERT INTO Sow6_2f VALUES (11); |
411 | INSERT INTO Sow6_2f VALUES (101.55); |
412 | ERROR 22003: Out of range value for column 'col1' at row 1 |
413 | @@ -758,14 +569,10 @@ |
414 | NULL |
415 | NULL |
416 | NULL |
417 | -NULL |
418 | -NULL |
419 | Warnings: |
420 | Error 1365 Division by 0 |
421 | Error 1365 Division by 0 |
422 | Error 1365 Division by 0 |
423 | -Error 1365 Division by 0 |
424 | -Error 1365 Division by 0 |
425 | INSERT INTO Sow6_2f VALUES ('a59b'); |
426 | ERROR HY000: Incorrect decimal value: 'a59b' for column 'col1' at row 1 |
427 | drop table Sow6_2f; |
428 | @@ -887,38 +694,6 @@ |
429 | ) ENGINE=X |
430 | drop table t1; |
431 | create table t1 ( |
432 | -f1 decimal not null default 17.49, |
433 | -f2 decimal not null default 17.68, |
434 | -f3 decimal not null default 99.2, |
435 | -f4 decimal not null default 99.7, |
436 | -f5 decimal not null default 104.49, |
437 | -f6 decimal not null default 199.91, |
438 | -f7 decimal not null default 999.9, |
439 | -f8 decimal not null default 9999.99); |
440 | -Warnings: |
441 | -Note 1265 Data truncated for column 'f1' at row 1 |
442 | -Note 1265 Data truncated for column 'f2' at row 1 |
443 | -Note 1265 Data truncated for column 'f3' at row 1 |
444 | -Note 1265 Data truncated for column 'f4' at row 1 |
445 | -Note 1265 Data truncated for column 'f5' at row 1 |
446 | -Note 1265 Data truncated for column 'f6' at row 1 |
447 | -Note 1265 Data truncated for column 'f7' at row 1 |
448 | -Note 1265 Data truncated for column 'f8' at row 1 |
449 | -insert into t1 (f1) values (1); |
450 | -Warnings: |
451 | -Note 1265 Data truncated for column 'f1' at row 1 |
452 | -Note 1265 Data truncated for column 'f2' at row 1 |
453 | -Note 1265 Data truncated for column 'f3' at row 1 |
454 | -Note 1265 Data truncated for column 'f4' at row 1 |
455 | -Note 1265 Data truncated for column 'f5' at row 1 |
456 | -Note 1265 Data truncated for column 'f6' at row 1 |
457 | -Note 1265 Data truncated for column 'f7' at row 1 |
458 | -Note 1265 Data truncated for column 'f8' at row 1 |
459 | -select * from t1; |
460 | -f1 f2 f3 f4 f5 f6 f7 f8 |
461 | -1 18 99 100 104 200 1000 10000 |
462 | -drop table t1; |
463 | -create table t1 ( |
464 | f0 decimal (30,30) not null DEFAULT 0, |
465 | f1 decimal (0,0) not null default 0); |
466 | show create table t1; |
467 | @@ -1179,122 +954,113 @@ |
468 | 0.011754943450000000000000000000 1.175494345e-2 |
469 | 0.117549434500000000000000000000 1.175494345e-1 |
470 | UPDATE t1 SET my_decimal = my_float; |
471 | +ERROR 01000: Data truncated for column 'my_decimal' at row 1 |
472 | SELECT my_decimal, my_float FROM t1; |
473 | my_decimal my_float |
474 | -0.000000000000000000000000000000 1.175494345e-32 |
475 | -0.000000000000000000000000000000 1.175494345e-31 |
476 | -0.000000000000000000000000000001 1.175494345e-30 |
477 | -0.000000000000000000000000000012 1.175494345e-29 |
478 | -0.000000000000000000000000000118 1.175494345e-28 |
479 | -0.000000000000000000000000001175 1.175494345e-27 |
480 | -0.000000000000000000000000011755 1.175494345e-26 |
481 | -0.000000000000000000000000117549 1.175494345e-25 |
482 | -0.000000000000000000000001175494 1.175494345e-24 |
483 | -0.000000000000000000000011754943 1.175494345e-23 |
484 | -0.000000000000000000000117549435 1.175494345e-22 |
485 | -0.000000000000000000001175494345 1.175494345e-21 |
486 | -0.000000000000000000011754943450 1.175494345e-20 |
487 | -0.000000000000000000117549434500 1.175494345e-19 |
488 | -0.000000000000000001175494345000 1.175494345e-18 |
489 | -0.000000000000000011754943450000 1.175494345e-17 |
490 | -0.000000000000000117549434500000 1.175494345e-16 |
491 | -0.000000000000001175494345000000 0.000000000000001175494345 |
492 | -0.000000000000011754943450000000 0.00000000000001175494345 |
493 | -0.000000000000117549434500000000 0.0000000000001175494345 |
494 | -0.000000000001175494345000000000 0.000000000001175494345 |
495 | -0.000000000011754943450000000000 0.00000000001175494345 |
496 | -0.000000000117549434500000000000 0.0000000001175494345 |
497 | -0.000000001175494345000000000000 0.000000001175494345 |
498 | -0.000000011754943450000000000000 0.00000001175494345 |
499 | -0.000000117549434500000000000000 0.0000001175494345 |
500 | -0.000001175494345000000000000000 0.000001175494345 |
501 | -0.000011754943450000000000000000 0.00001175494345 |
502 | -0.000117549434500000000000000000 0.0001175494345 |
503 | -0.001175494345000000000000000000 0.001175494345 |
504 | -0.011754943450000000000000000000 0.01175494345 |
505 | -0.117549434500000000000000000000 0.1175494345 |
506 | +NULL 1.175494345e-32 |
507 | +NULL 1.175494345e-31 |
508 | +NULL 1.175494345e-30 |
509 | +NULL 1.175494345e-29 |
510 | +NULL 1.175494345e-28 |
511 | +NULL 1.175494345e-27 |
512 | +NULL 1.175494345e-26 |
513 | +NULL 1.175494345e-25 |
514 | +NULL 1.175494345e-24 |
515 | +NULL 1.175494345e-23 |
516 | +NULL 1.175494345e-22 |
517 | +NULL 1.175494345e-21 |
518 | +NULL 1.175494345e-20 |
519 | +NULL 1.175494345e-19 |
520 | +NULL 1.175494345e-18 |
521 | +NULL 1.175494345e-17 |
522 | +NULL 1.175494345e-16 |
523 | +NULL 0.000000000000001175494345 |
524 | +NULL 0.00000000000001175494345 |
525 | +NULL 0.0000000000001175494345 |
526 | +NULL 0.000000000001175494345 |
527 | +NULL 0.00000000001175494345 |
528 | +NULL 0.0000000001175494345 |
529 | +NULL 0.000000001175494345 |
530 | +NULL 0.00000001175494345 |
531 | +NULL 0.0000001175494345 |
532 | +NULL 0.000001175494345 |
533 | +NULL 0.00001175494345 |
534 | +NULL 0.0001175494345 |
535 | +NULL 0.001175494345 |
536 | +NULL 0.01175494345 |
537 | +NULL 0.1175494345 |
538 | UPDATE t1 SET my_decimal = my_double; |
539 | +ERROR 01000: Data truncated for column 'my_decimal' at row 1 |
540 | SELECT my_decimal, my_double FROM t1; |
541 | my_decimal my_double |
542 | -0.000000000000000000000000000000 1.175494345e-32 |
543 | -0.000000000000000000000000000000 1.175494345e-31 |
544 | -0.000000000000000000000000000001 1.175494345e-30 |
545 | -0.000000000000000000000000000012 1.175494345e-29 |
546 | -0.000000000000000000000000000118 1.175494345e-28 |
547 | -0.000000000000000000000000001175 1.175494345e-27 |
548 | -0.000000000000000000000000011755 1.175494345e-26 |
549 | -0.000000000000000000000000117549 1.175494345e-25 |
550 | -0.000000000000000000000001175494 1.175494345e-24 |
551 | -0.000000000000000000000011754943 1.175494345e-23 |
552 | -0.000000000000000000000117549435 1.175494345e-22 |
553 | -0.000000000000000000001175494345 1.175494345e-21 |
554 | -0.000000000000000000011754943450 1.175494345e-20 |
555 | -0.000000000000000000117549434500 1.175494345e-19 |
556 | -0.000000000000000001175494345000 1.175494345e-18 |
557 | -0.000000000000000011754943450000 1.175494345e-17 |
558 | -0.000000000000000117549434500000 1.175494345e-16 |
559 | -0.000000000000001175494345000000 0.000000000000001175494345 |
560 | -0.000000000000011754943450000000 0.00000000000001175494345 |
561 | -0.000000000000117549434500000000 0.0000000000001175494345 |
562 | -0.000000000001175494345000000000 0.000000000001175494345 |
563 | -0.000000000011754943450000000000 0.00000000001175494345 |
564 | -0.000000000117549434500000000000 0.0000000001175494345 |
565 | -0.000000001175494345000000000000 0.000000001175494345 |
566 | -0.000000011754943450000000000000 0.00000001175494345 |
567 | -0.000000117549434500000000000000 0.0000001175494345 |
568 | -0.000001175494345000000000000000 0.000001175494345 |
569 | -0.000011754943450000000000000000 0.00001175494345 |
570 | -0.000117549434500000000000000000 0.0001175494345 |
571 | -0.001175494345000000000000000000 0.001175494345 |
572 | -0.011754943450000000000000000000 0.01175494345 |
573 | -0.117549434500000000000000000000 0.1175494345 |
574 | +NULL 1.175494345e-32 |
575 | +NULL 1.175494345e-31 |
576 | +NULL 1.175494345e-30 |
577 | +NULL 1.175494345e-29 |
578 | +NULL 1.175494345e-28 |
579 | +NULL 1.175494345e-27 |
580 | +NULL 1.175494345e-26 |
581 | +NULL 1.175494345e-25 |
582 | +NULL 1.175494345e-24 |
583 | +NULL 1.175494345e-23 |
584 | +NULL 1.175494345e-22 |
585 | +NULL 1.175494345e-21 |
586 | +NULL 1.175494345e-20 |
587 | +NULL 1.175494345e-19 |
588 | +NULL 1.175494345e-18 |
589 | +NULL 1.175494345e-17 |
590 | +NULL 1.175494345e-16 |
591 | +NULL 0.000000000000001175494345 |
592 | +NULL 0.00000000000001175494345 |
593 | +NULL 0.0000000000001175494345 |
594 | +NULL 0.000000000001175494345 |
595 | +NULL 0.00000000001175494345 |
596 | +NULL 0.0000000001175494345 |
597 | +NULL 0.000000001175494345 |
598 | +NULL 0.00000001175494345 |
599 | +NULL 0.0000001175494345 |
600 | +NULL 0.000001175494345 |
601 | +NULL 0.00001175494345 |
602 | +NULL 0.0001175494345 |
603 | +NULL 0.001175494345 |
604 | +NULL 0.01175494345 |
605 | +NULL 0.1175494345 |
606 | UPDATE t1 SET my_decimal = my_varchar; |
607 | -Warnings: |
608 | -Note 1265 Data truncated for column 'my_decimal' at row 1 |
609 | -Note 1265 Data truncated for column 'my_decimal' at row 2 |
610 | -Note 1265 Data truncated for column 'my_decimal' at row 3 |
611 | -Note 1265 Data truncated for column 'my_decimal' at row 4 |
612 | -Note 1265 Data truncated for column 'my_decimal' at row 5 |
613 | -Note 1265 Data truncated for column 'my_decimal' at row 6 |
614 | -Note 1265 Data truncated for column 'my_decimal' at row 7 |
615 | -Note 1265 Data truncated for column 'my_decimal' at row 8 |
616 | -Note 1265 Data truncated for column 'my_decimal' at row 9 |
617 | -Note 1265 Data truncated for column 'my_decimal' at row 10 |
618 | -Note 1265 Data truncated for column 'my_decimal' at row 11 |
619 | +ERROR 01000: Data truncated for column 'my_decimal' at row 1 |
620 | SELECT my_decimal, my_varchar FROM t1; |
621 | my_decimal my_varchar |
622 | -0.000000000000000000000000000000 1.175494345e-32 |
623 | -0.000000000000000000000000000000 1.175494345e-31 |
624 | -0.000000000000000000000000000001 1.175494345e-30 |
625 | -0.000000000000000000000000000012 1.175494345e-29 |
626 | -0.000000000000000000000000000118 1.175494345e-28 |
627 | -0.000000000000000000000000001175 1.175494345e-27 |
628 | -0.000000000000000000000000011755 1.175494345e-26 |
629 | -0.000000000000000000000000117549 1.175494345e-25 |
630 | -0.000000000000000000000001175494 1.175494345e-24 |
631 | -0.000000000000000000000011754943 1.175494345e-23 |
632 | -0.000000000000000000000117549435 1.175494345e-22 |
633 | -0.000000000000000000001175494345 1.175494345e-21 |
634 | -0.000000000000000000011754943450 1.175494345e-20 |
635 | -0.000000000000000000117549434500 1.175494345e-19 |
636 | -0.000000000000000001175494345000 1.175494345e-18 |
637 | -0.000000000000000011754943450000 1.175494345e-17 |
638 | -0.000000000000000117549434500000 1.175494345e-16 |
639 | -0.000000000000001175494345000000 1.175494345e-15 |
640 | -0.000000000000011754943450000000 1.175494345e-14 |
641 | -0.000000000000117549434500000000 1.175494345e-13 |
642 | -0.000000000001175494345000000000 1.175494345e-12 |
643 | -0.000000000011754943450000000000 1.175494345e-11 |
644 | -0.000000000117549434500000000000 1.175494345e-10 |
645 | -0.000000001175494345000000000000 1.175494345e-9 |
646 | -0.000000011754943450000000000000 1.175494345e-8 |
647 | -0.000000117549434500000000000000 1.175494345e-7 |
648 | -0.000001175494345000000000000000 1.175494345e-6 |
649 | -0.000011754943450000000000000000 1.175494345e-5 |
650 | -0.000117549434500000000000000000 1.175494345e-4 |
651 | -0.001175494345000000000000000000 1.175494345e-3 |
652 | -0.011754943450000000000000000000 1.175494345e-2 |
653 | -0.117549434500000000000000000000 1.175494345e-1 |
654 | +NULL 1.175494345e-32 |
655 | +NULL 1.175494345e-31 |
656 | +NULL 1.175494345e-30 |
657 | +NULL 1.175494345e-29 |
658 | +NULL 1.175494345e-28 |
659 | +NULL 1.175494345e-27 |
660 | +NULL 1.175494345e-26 |
661 | +NULL 1.175494345e-25 |
662 | +NULL 1.175494345e-24 |
663 | +NULL 1.175494345e-23 |
664 | +NULL 1.175494345e-22 |
665 | +NULL 1.175494345e-21 |
666 | +NULL 1.175494345e-20 |
667 | +NULL 1.175494345e-19 |
668 | +NULL 1.175494345e-18 |
669 | +NULL 1.175494345e-17 |
670 | +NULL 1.175494345e-16 |
671 | +NULL 1.175494345e-15 |
672 | +NULL 1.175494345e-14 |
673 | +NULL 1.175494345e-13 |
674 | +NULL 1.175494345e-12 |
675 | +NULL 1.175494345e-11 |
676 | +NULL 1.175494345e-10 |
677 | +NULL 1.175494345e-9 |
678 | +NULL 1.175494345e-8 |
679 | +NULL 1.175494345e-7 |
680 | +NULL 1.175494345e-6 |
681 | +NULL 1.175494345e-5 |
682 | +NULL 1.175494345e-4 |
683 | +NULL 1.175494345e-3 |
684 | +NULL 1.175494345e-2 |
685 | +NULL 1.175494345e-1 |
686 | DROP TABLE t1; |
687 | create table t1 (c1 decimal(64)); |
688 | insert into t1 values( |
689 | @@ -1413,15 +1179,7 @@ |
690 | 1 |
691 | DROP TABLE t1; |
692 | CREATE TABLE t1 SELECT 0.123456789012345678901234567890123456 AS f1; |
693 | -Warnings: |
694 | -Note 1265 Data truncated for column 'f1' at row 1 |
695 | -DESC t1; |
696 | -Field Type Null Key Default Extra |
697 | -f1 decimal(31,30) NO NULL |
698 | -SELECT f1 FROM t1; |
699 | -f1 |
700 | -0.123456789012345678901234567890 |
701 | -DROP TABLE t1; |
702 | +ERROR 01000: Data truncated for column 'f1' at row 1 |
703 | CREATE TABLE t1 SELECT 123451234512345123451234512345123451234512345.678906789067890678906789067890678906789067890 AS f1; |
704 | ERROR 22003: Out of range value for column 'f1' at row 1 |
705 | End of 5.0 tests |
706 | @@ -1452,3 +1210,5 @@ |
707 | select cast(98.6 as decimal(2,0)); |
708 | cast(98.6 as decimal(2,0)) |
709 | 99 |
710 | +create table t1 (f1 decimal not null default 17.49); |
711 | +ERROR 42000: Invalid default value for 'f1' |
712 | |
713 | === modified file 'tests/t/strict.test' |
714 | --- tests/t/strict.test 2009-03-16 15:20:27 +0000 |
715 | +++ tests/t/strict.test 2009-04-01 01:27:08 +0000 |
716 | @@ -94,9 +94,11 @@ |
717 | # Test INSERT with NUMERIC |
718 | |
719 | CREATE TABLE t1 (col1 NUMERIC(4,2)); |
720 | -INSERT INTO t1 VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01); |
721 | +#INSERT INTO t1 VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01); |
722 | +INSERT INTO t1 VALUES (10.55),(10.55),(0),(-10.55),(-10.55),(11),(1e+01); |
723 | # Note that the +/-10.5555 is inserted as +/-10.55, not +/-10.56 ! |
724 | -INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+01'); |
725 | +#INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+01'); |
726 | +INSERT INTO t1 VALUES ('10.55'),('10.55'),('-10.55'),('-10.55'),('11'),('1e+01'); |
727 | |
728 | # The 2 following inserts should generate a warning, but doesn't yet |
729 | # because NUMERIC works like DECIMAL |
730 | |
731 | === modified file 'tests/t/type_decimal.test' |
732 | --- tests/t/type_decimal.test 2009-02-17 01:09:17 +0000 |
733 | +++ tests/t/type_decimal.test 2009-04-01 01:27:08 +0000 |
734 | @@ -221,6 +221,7 @@ |
735 | insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11); |
736 | --error 1264 out of range value |
737 | insert into t1 values (1e+100),(1e-100),(-1e+100); |
738 | +--error 1265 |
739 | insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0); |
740 | insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 "); |
741 | select * from t1; |
742 | @@ -300,11 +301,11 @@ |
743 | # Bug #7589: a problem with update from column |
744 | # |
745 | |
746 | -create table t1(a decimal(10,5), b decimal(10,1)); |
747 | -insert into t1 values(123.12345, 123.12345); |
748 | -update t1 set b=a; |
749 | -select * from t1; |
750 | -drop table t1; |
751 | +#create table t1(a decimal(10,5), b decimal(10,1)); |
752 | +#insert into t1 values(123.12345, 123.12345); |
753 | +#update t1 set b=a; |
754 | +#select * from t1; |
755 | +#drop table t1; |
756 | |
757 | --echo End of 4.1 tests |
758 | |
759 | @@ -510,6 +511,7 @@ |
760 | SELECT ROUND( a, 100 ) AS c FROM t4 ORDER BY c; |
761 | |
762 | delete from t1; |
763 | +--error 1265 |
764 | INSERT INTO t1 VALUES (1234567890, 20), (999.99, 5); |
765 | show create table t1; |
766 | |
767 | |
768 | === modified file 'tests/t/type_newdecimal.test' |
769 | --- tests/t/type_newdecimal.test 2009-03-11 06:37:19 +0000 |
770 | +++ tests/t/type_newdecimal.test 2009-04-01 01:27:08 +0000 |
771 | @@ -106,99 +106,99 @@ |
772 | # Trydy's tests |
773 | # |
774 | select 1e10/0e0; |
775 | -create table wl1612 (col1 int, col2 decimal(38,10), col3 numeric(38,10)); |
776 | -insert into wl1612 values(1,12345678901234567890.1234567890,12345678901234567890.1234567890); |
777 | -select * from wl1612; |
778 | -insert into wl1612 values(2,01234567890123456789.0123456789,01234567890123456789.0123456789); |
779 | -select * from wl1612 where col1=2; |
780 | -insert into wl1612 values(3,1234567890123456789012345678.0123456789,1234567890123456789012345678.0123456789); |
781 | -select * from wl1612 where col1=3; |
782 | - |
783 | -select col1/0 from wl1612; |
784 | -select col2/0 from wl1612; |
785 | -select col3/0 from wl1612; |
786 | - |
787 | -insert into wl1612 values(5,5000.0005,5000.0005); |
788 | -insert into wl1612 values(6,5000.0005,5000.0005); |
789 | -select sum(col2),sum(col3) from wl1612; |
790 | +#create table wl1612 (col1 int, col2 decimal(38,10), col3 numeric(38,10)); |
791 | +#insert into wl1612 values(1,12345678901234567890.1234567890,12345678901234567890.1234567890); |
792 | +#select * from wl1612; |
793 | +#insert into wl1612 values(2,01234567890123456789.0123456789,01234567890123456789.0123456789); |
794 | +#select * from wl1612 where col1=2; |
795 | +#insert into wl1612 values(3,1234567890123456789012345678.0123456789,1234567890123456789012345678.0123456789); |
796 | +#select * from wl1612 where col1=3; |
797 | + |
798 | +#select col1/0 from wl1612; |
799 | +#select col2/0 from wl1612; |
800 | +#select col3/0 from wl1612; |
801 | + |
802 | +#insert into wl1612 values(5,5000.0005,5000.0005); |
803 | +#insert into wl1612 values(6,5000.0005,5000.0005); |
804 | +#select sum(col2),sum(col3) from wl1612; |
805 | #select avg(col2),avg(col3) from wl1612; |
806 | |
807 | -insert into wl1612 values(7,500000.000005,500000.000005); |
808 | -insert into wl1612 values(8,500000.000005,500000.000005); |
809 | -select sum(col2),sum(col3) from wl1612 where col1>4; |
810 | +#insert into wl1612 values(7,500000.000005,500000.000005); |
811 | +#insert into wl1612 values(8,500000.000005,500000.000005); |
812 | +#select sum(col2),sum(col3) from wl1612 where col1>4; |
813 | #select avg(col2),avg(col3) from wl1612 where col1>4; |
814 | |
815 | #insert into wl1612 (col1,col2) values(9,123456789012345678901234567890); |
816 | #insert into wl1612 (col1,col3) values(9,123456789012345678901234567890); |
817 | |
818 | -insert into wl1612 (col1, col2) values(9,1.01234567891); |
819 | -insert into wl1612 (col1, col2) values(10,1.01234567894); |
820 | -insert into wl1612 (col1, col2) values(11,1.01234567895); |
821 | -insert into wl1612 (col1, col2) values(12,1.01234567896); |
822 | -select col1,col2 from wl1612 where col1>8; |
823 | - |
824 | -insert into wl1612 (col1, col3) values(13,1.01234567891); |
825 | -insert into wl1612 (col1, col3) values(14,1.01234567894); |
826 | -insert into wl1612 (col1, col3) values(15,1.01234567895); |
827 | -insert into wl1612 (col1, col3) values(16,1.01234567896); |
828 | -select col1,col3 from wl1612 where col1>12; |
829 | - |
830 | -select col1 from wl1612 where col1>4 and col2=1.01234567891; |
831 | -#-- should return 0 rows |
832 | -# |
833 | -select col1 from wl1612 where col1>4 and col2=1.0123456789; |
834 | -#-- should return col1 values 9 & 10 |
835 | -# |
836 | -select col1 from wl1612 where col1>4 and col2<>1.0123456789; |
837 | -#-- should return col1 values 5,6,7,8,11,12 |
838 | -# |
839 | -select col1 from wl1612 where col1>4 and col2<1.0123456789; |
840 | -#-- should return 0 rows |
841 | -# |
842 | -select col1 from wl1612 where col1>4 and col2<=1.0123456789; |
843 | -#-- should return col1 values 9 & 10 |
844 | -# |
845 | -select col1 from wl1612 where col1>4 and col2>1.0123456789; |
846 | -#-- should return col1 values 5,6,7,8,11,12 |
847 | -# |
848 | -select col1 from wl1612 where col1>4 and col2>=1.0123456789; |
849 | +#insert into wl1612 (col1, col2) values(9,1.01234567891); |
850 | +#insert into wl1612 (col1, col2) values(10,1.01234567894); |
851 | +#insert into wl1612 (col1, col2) values(11,1.01234567895); |
852 | +#insert into wl1612 (col1, col2) values(12,1.01234567896); |
853 | +#select col1,col2 from wl1612 where col1>8; |
854 | + |
855 | +#insert into wl1612 (col1, col3) values(13,1.01234567891); |
856 | +#insert into wl1612 (col1, col3) values(14,1.01234567894); |
857 | +#insert into wl1612 (col1, col3) values(15,1.01234567895); |
858 | +#insert into wl1612 (col1, col3) values(16,1.01234567896); |
859 | +#select col1,col3 from wl1612 where col1>12; |
860 | + |
861 | +#select col1 from wl1612 where col1>4 and col2=1.01234567891; |
862 | +#-- should return 0 rows |
863 | +# |
864 | +#select col1 from wl1612 where col1>4 and col2=1.0123456789; |
865 | +#-- should return col1 values 9 & 10 |
866 | +# |
867 | +#select col1 from wl1612 where col1>4 and col2<>1.0123456789; |
868 | +#-- should return col1 values 5,6,7,8,11,12 |
869 | +# |
870 | +#select col1 from wl1612 where col1>4 and col2<1.0123456789; |
871 | +#-- should return 0 rows |
872 | +# |
873 | +#select col1 from wl1612 where col1>4 and col2<=1.0123456789; |
874 | +#-- should return col1 values 9 & 10 |
875 | +# |
876 | +#select col1 from wl1612 where col1>4 and col2>1.0123456789; |
877 | +#-- should return col1 values 5,6,7,8,11,12 |
878 | +# |
879 | +#select col1 from wl1612 where col1>4 and col2>=1.0123456789; |
880 | #-- should return col1 values 5,6,7,8,910,11,12 |
881 | # |
882 | #select col1, col2 from wl1612 where col1=11 or col1=12; |
883 | -select col1 from wl1612 where col1>4 and col2=1.012345679; |
884 | +#select col1 from wl1612 where col1>4 and col2=1.012345679; |
885 | #-- should return col1 values 11,12 |
886 | # |
887 | -select col1 from wl1612 where col1>4 and col2<>1.012345679; |
888 | +#select col1 from wl1612 where col1>4 and col2<>1.012345679; |
889 | #-- should return col1 values 5,6,7,8,9,10 |
890 | # |
891 | -select col1 from wl1612 where col1>4 and col3=1.01234567891; |
892 | -#-- should return 0 rows |
893 | -# |
894 | -select col1 from wl1612 where col1>4 and col3=1.0123456789; |
895 | -#-- should return col1 values 13,14 |
896 | -# |
897 | -select col1 from wl1612 where col1>4 and col3<>1.0123456789; |
898 | -#-- should return col1 values 5,6,7,8,15,16 |
899 | -# |
900 | -select col1 from wl1612 where col1>4 and col3<1.0123456789; |
901 | -#-- should return 0 rows |
902 | -# |
903 | -select col1 from wl1612 where col1>4 and col3<=1.0123456789; |
904 | -#-- should return col1 values 13,14 |
905 | -# |
906 | -select col1 from wl1612 where col1>4 and col3>1.0123456789; |
907 | -#-- should return col1 values 5,6,7,8,15,16 |
908 | -# |
909 | -select col1 from wl1612 where col1>4 and col3>=1.0123456789; |
910 | +#select col1 from wl1612 where col1>4 and col3=1.01234567891; |
911 | +#-- should return 0 rows |
912 | +# |
913 | +#select col1 from wl1612 where col1>4 and col3=1.0123456789; |
914 | +#-- should return col1 values 13,14 |
915 | +# |
916 | +#select col1 from wl1612 where col1>4 and col3<>1.0123456789; |
917 | +#-- should return col1 values 5,6,7,8,15,16 |
918 | +# |
919 | +#select col1 from wl1612 where col1>4 and col3<1.0123456789; |
920 | +#-- should return 0 rows |
921 | +# |
922 | +#select col1 from wl1612 where col1>4 and col3<=1.0123456789; |
923 | +#-- should return col1 values 13,14 |
924 | +# |
925 | +#select col1 from wl1612 where col1>4 and col3>1.0123456789; |
926 | +#-- should return col1 values 5,6,7,8,15,16 |
927 | +# |
928 | +#select col1 from wl1612 where col1>4 and col3>=1.0123456789; |
929 | #-- should return col1 values 5,6,7,8,13,14,15,16 |
930 | # |
931 | -select col1 from wl1612 where col1>4 and col3=1.012345679; |
932 | +#select col1 from wl1612 where col1>4 and col3=1.012345679; |
933 | #-- should return col1 values 15,16 |
934 | # |
935 | -select col1 from wl1612 where col1>4 and col3<>1.012345679; |
936 | +#select col1 from wl1612 where col1>4 and col3<>1.012345679; |
937 | #-- should return col1 values 5,6,7,8,13,14 |
938 | # |
939 | -drop table wl1612; |
940 | +#drop table wl1612; |
941 | # |
942 | select 1/3; |
943 | # |
944 | @@ -825,11 +825,13 @@ |
945 | CREATE TABLE Sow6_2f (col1 NUMERIC(4,2)); |
946 | #-- should return OK |
947 | INSERT INTO Sow6_2f VALUES (10.55); |
948 | -#-- should return OK |
949 | +#-- should return E_DEC_TRUNCATION |
950 | +--error 1265 |
951 | INSERT INTO Sow6_2f VALUES (10.5555); |
952 | #-- should return OK |
953 | INSERT INTO Sow6_2f VALUES (-10.55); |
954 | -#-- should return OK |
955 | +#-- should return E_DEC_TRUNCATION |
956 | +--error 1265 |
957 | INSERT INTO Sow6_2f VALUES (-10.5555); |
958 | #-- should return OK |
959 | INSERT INTO Sow6_2f VALUES (11); |
960 | @@ -979,22 +981,6 @@ |
961 | drop table t1; |
962 | |
963 | # |
964 | -# Bug 11557 (DEFAULT values rounded improperly |
965 | -# |
966 | -create table t1 ( |
967 | - f1 decimal not null default 17.49, |
968 | - f2 decimal not null default 17.68, |
969 | - f3 decimal not null default 99.2, |
970 | - f4 decimal not null default 99.7, |
971 | - f5 decimal not null default 104.49, |
972 | - f6 decimal not null default 199.91, |
973 | - f7 decimal not null default 999.9, |
974 | - f8 decimal not null default 9999.99); |
975 | -insert into t1 (f1) values (1); |
976 | -select * from t1; |
977 | -drop table t1; |
978 | - |
979 | -# |
980 | # Bug 12173 (show create table fails) |
981 | # |
982 | create table t1 ( |
983 | @@ -1046,7 +1032,8 @@ |
984 | # if (nr2 != nr) |
985 | # fails randomly depending on compiler options |
986 | |
987 | ---disable_warnings |
988 | +#--disable_warnings |
989 | +--error 1265 |
990 | UPDATE t1 SET my_decimal = my_float; |
991 | |
992 | # Expected result 0.000000000011754943372854760000 |
993 | @@ -1055,9 +1042,11 @@ |
994 | --replace_result 0.000000000011754943372854770000 0.000000000011754943372854760000 |
995 | SELECT my_decimal, my_float FROM t1; |
996 | |
997 | +--error 1265 |
998 | UPDATE t1 SET my_decimal = my_double; |
999 | SELECT my_decimal, my_double FROM t1; |
1000 | --enable_warnings |
1001 | +--error 1265 |
1002 | UPDATE t1 SET my_decimal = my_varchar; |
1003 | SELECT my_decimal, my_varchar FROM t1; |
1004 | |
1005 | @@ -1188,10 +1177,15 @@ |
1006 | # maxmimum precision of 30 places after the decimal point. Show that |
1007 | # temp field creation beyond that works and throws a truncation warning. |
1008 | # DECIMAL(37,36) should be adjusted to DECIMAL(31,30). |
1009 | +# After Bug#337038, truncation throws an error and not a warning. Thus, we |
1010 | +# will change the behavior here to expect an error. We are leaving the |
1011 | +# original test case here so people can see how behavior changed. |
1012 | +#CREATE TABLE t1 SELECT 0.123456789012345678901234567890123456 AS f1; |
1013 | +#DESC t1; |
1014 | +#SELECT f1 FROM t1; |
1015 | +#DROP TABLE t1; |
1016 | +--error 1265 |
1017 | CREATE TABLE t1 SELECT 0.123456789012345678901234567890123456 AS f1; |
1018 | -DESC t1; |
1019 | -SELECT f1 FROM t1; |
1020 | -DROP TABLE t1; |
1021 | |
1022 | # too many decimal places, AND too many digits altogether (90 = 45+45). |
1023 | # should preserve integers (65 = 45+20) |
1024 | @@ -1210,3 +1204,10 @@ |
1025 | select cast(99.6 as decimal(2,0)); |
1026 | select cast(-13.4 as decimal(2,1)); |
1027 | select cast(98.6 as decimal(2,0)); |
1028 | + |
1029 | +# |
1030 | +## Bug337038 Decimal truncation is warning, not error |
1031 | +# |
1032 | +--error 1067 |
1033 | +create table t1 (f1 decimal not null default 17.49); |
1034 | + |
This patch fixes bug#337038 - decimal truncation is warning, not error.
Now, the behavior is to error when decimal truncation occurs but the user can still issue the show warnings; command after the truncation occurs to still see the original warning also.
-Padraig