~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/variables.test

  • Committer: Stewart Smith
  • Date: 2010-08-12 16:48:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1707.
  • Revision ID: stewart@flamingspork.com-20100812164846-s9bhy47g60bvqs41
bug lp:611379 Equivalent queries with Impossible where return different results

The following two equivalent queries return different results in maria 5.2 and 5.3 (and identical results in mysql 5.5.5) :

SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN CC ON table2 .`col_varchar_key` ) ON table2 .`pk` ;

SELECT * FROM ( SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN CC ON table2 .`col_varchar_key` ) ON table2 .`pk` );

MariaDB returns 0 on the second query and NULL on the first, whereas MySQL returns NULL on both. In MariaDB, both EXPLAIN plans agree that "Impossible WHERE noticed after reading const tables"



We have some slightly different output in drizzle:

main.bug_lp611379 [ fail ]
drizzletest: At line 9: query 'explain select * from (select sum(distinct t1.a) from t1,t2 where t1.a=t2.a)
as t' failed: 1048: Column 'sum(distinct t1.a)' cannot be null

but the fix gets us the correct query results, although with slightly different execution plans.



This fix is directly ported from MariaDB.

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
 
147
147
# The following should give errors
148
148
 
149
 
--error ER_UNKNOWN_SYSTEM_VARIABLE
 
149
--error 1193
150
150
set unknown_variable=1;
151
 
--error ER_WRONG_TYPE_FOR_VAR
 
151
--error 1232
152
152
set max_join_size="hello";
153
 
--error ER_UNKNOWN_STORAGE_ENGINE
 
153
--error 1286
154
154
set storage_engine=UNKNOWN_TABLE_TYPE;
155
 
--error ER_NO_DEFAULT
 
155
--error 1230
156
156
set GLOBAL storage_engine=DEFAULT;
157
 
--error ER_LOCAL_VARIABLE
 
157
--error 1228
158
158
set global autocommit=1;
159
 
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
 
159
--error 1238
160
160
select @@global.timestamp;
161
 
--error ER_INCORRECT_GLOBAL_LOCAL_VAR 
 
161
--error 1238 
162
162
set @@version='';
163
 
--error ER_GLOBAL_VARIABLE
 
163
--error 1229
164
164
set myisam_max_sort_file_size=100;
165
 
--error ER_WRONG_VALUE_FOR_VAR
 
165
--error 1231
166
166
set @@SQL_WARNINGS=NULL;
167
167
 
168
168
# Test setting all variables
268
268
--echo *** LC_TIME_NAMES: testing with string expressions
269
269
set lc_time_names=concat('de','_','DE');
270
270
select @@lc_time_names;
271
 
--error ER_UNKNOWN_ERROR
 
271
--error 1105
272
272
set lc_time_names=concat('de','+','DE');
273
273
select @@lc_time_names;
274
274
--echo LC_TIME_NAMES: testing with numeric expressions
275
275
set @@lc_time_names=1+2;
276
276
select @@lc_time_names;
277
 
--error ER_WRONG_TYPE_FOR_VAR
 
277
--error 1232
278
278
set @@lc_time_names=1/0;
279
279
select @@lc_time_names;
280
280
set lc_time_names=en_US;
281
281
--echo LC_TIME_NAMES: testing NULL and a negative number:
282
 
--error ER_WRONG_VALUE_FOR_VAR
 
282
--error 1231
283
283
set lc_time_names=NULL;
284
 
--error ER_UNKNOWN_ERROR
 
284
--error 1105
285
285
set lc_time_names=-1;
286
286
select @@lc_time_names;
287
287
--echo LC_TIME_NAMES: testing locale with the last ID:
288
288
set lc_time_names=108;
289
289
select @@lc_time_names;
290
290
--echo LC_TIME_NAMES: testing a number beyond the valid ID range:
291
 
--error ER_UNKNOWN_ERROR
 
291
--error 1105
292
292
set lc_time_names=109;
293
293
select @@lc_time_names;
294
294
--echo LC_TIME_NAMES: testing that 0 is en_US:
341
341
# Bug #10339: read only variables.
342
342
#
343
343
 
344
 
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
 
344
--error 1238
345
345
set @@warning_count=1;
346
 
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
 
346
--error 1238
347
347
set @@global.error_count=1;
348
348
 
349
349
#
363
363
#
364
364
# Bug #11775 Variable character_set_system does not exist (sometimes)
365
365
#
366
 
--error ER_UNKNOWN_SYSTEM_VARIABLE
 
366
--error 1193
367
367
select @@character_set_system;
368
 
--error ER_UNKNOWN_SYSTEM_VARIABLE
 
368
--error 1193
369
369
set global character_set_system = utf8;
370
 
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
 
370
--error 1238
371
371
set @@global.version_compile_os='234';
372
372
 
373
373
#
374
374
# Check character_set_filesystem variable invalid for Drizzle
375
375
#
376
 
--error ER_UNKNOWN_SYSTEM_VARIABLE
 
376
--error 1193
377
377
set @@global.character_set_filesystem=utf8;
378
 
--error ER_UNKNOWN_SYSTEM_VARIABLE
 
378
--error 1193
379
379
set character_set_filesystem=utf8;
380
380
 
381
381
#
452
452
# Don't actually output, since it depends on the system
453
453
--replace_column 1 #
454
454
select @@hostname;
455
 
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
 
455
--error 1238
456
456
set @@hostname= "anothername";
457
457
--replace_column 2 #
458
458
show variables like 'hostname';
465
465
# Bug #19263: variables.test doesn't clean up after itself (II/II --
466
466
# restore)
467
467
#
468
 
--error ER_UNKNOWN_SYSTEM_VARIABLE
 
468
--error 1193
469
469
set global flush_time                =@my_flush_time;
470
470
set global max_connect_errors        =@my_max_connect_errors;
471
471
set global max_heap_table_size       =@my_max_heap_table_size;
472
472
set global max_join_size             =@my_max_join_size;
473
473
# No default
474
474
set global max_write_lock_count      =default;
 
475
--error 1232
 
476
set global myisam_data_pointer_size  =@my_myisam_data_pointer_size;
475
477
set global mysql_protocol_buffer_length= @my_mysql_protocol_buffer_length;
476
478
set global server_id                 =@my_server_id;
477
479
set global storage_engine            =@my_storage_engine;
478
 
--error ER_UNKNOWN_SYSTEM_VARIABLE
 
480
--error 1193
479
481
set global thread_cache_size         =@my_thread_cache_size;
480
482
set global myisam_sort_buffer_size   =@my_myisam_sort_buffer_size;
481
483