Commit graph

102 commits

Author SHA1 Message Date
Michael Widenius
ae5bc05988 Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32767);
insert into t1 values(NULL);
ERROR 1062 (23000): Duplicate entry '32767' for key 'PRIMARY

Now on always gets error HA_ERR_AUTOINC_RANGE=167 "Out of range value for column", independent of
store engine, SQL Mode or number of inserted rows. This is an unique error that is easier to test for in replication.

Another bug fix is that we now get an error when trying to insert a too big auto-generated value, even in non-strict mode.
Before one get insted the max column value inserted.
This patch also fixes some issues with inserting negative numbers in an auto-increment column.
Fixed the ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
Added SQLSTATE errors for handler errors

Smaller bug fixes:
* Added warnings for duplicate key errors when using INSERT IGNORE
* Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
* Allow one to see how cmake is called by using --just-print --just-configure


BUILD/FINISH.sh:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
cmake/configure.pl:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
include/CMakeLists.txt:
  Added handler_state.h
include/handler_state.h:
  SQLSTATE for handler error messages.
  Required for HA_ERR_AUTOINC_ERANGE, but solves also some other cases.
mysql-test/extra/binlog_tests/binlog.test:
  Fixed old wrong behaviour
  Added more tests
mysql-test/extra/binlog_tests/binlog_insert_delayed.test:
  Reset binary log to only print what's necessary in show_binlog_events
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  Update to new error codes
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
  Ignore warnings as this depends on how the test is run
mysql-test/include/strict_autoinc.inc:
  On now gets an error on overflow
mysql-test/r/auto_increment.result:
  Update results after fixing error message
mysql-test/r/auto_increment_ranges_innodb.result:
  Test new behaviour
mysql-test/r/auto_increment_ranges_myisam.result:
  Test new behaviour
mysql-test/r/commit_1innodb.result:
  Added warnings for duplicate key error
mysql-test/r/create.result:
  Added warnings for duplicate key error
mysql-test/r/insert.result:
  Added warnings for duplicate key error
mysql-test/r/insert_select.result:
  Added warnings for duplicate key error
mysql-test/r/insert_update.result:
  Added warnings for duplicate key error
mysql-test/r/mix2_myisam.result:
  Added warnings for duplicate key error
mysql-test/r/myisam_mrr.result:
  Added warnings for duplicate key error
mysql-test/r/null_key.result:
  Added warnings for duplicate key error
mysql-test/r/replace.result:
  Update to new error codes
mysql-test/r/strict_autoinc_1myisam.result:
  Update to new error codes
mysql-test/r/strict_autoinc_2innodb.result:
  Update to new error codes
mysql-test/r/strict_autoinc_3heap.result:
  Update to new error codes
mysql-test/r/trigger.result:
  Added warnings for duplicate key error
mysql-test/r/xtradb_mrr.result:
  Added warnings for duplicate key error
mysql-test/suite/binlog/r/binlog_innodb_row.result:
  Updated result
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  Updated result
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Updated result
mysql-test/suite/innodb/r/innodb-autoinc.result:
  Update to new error codes
mysql-test/suite/innodb/r/innodb-lock.result:
  Updated results
mysql-test/suite/innodb/r/innodb.result:
  Updated results
mysql-test/suite/innodb/r/innodb_bug56947.result:
  Updated results
mysql-test/suite/innodb/r/innodb_mysql.result:
  Updated results
mysql-test/suite/innodb/t/innodb-autoinc.test:
  Update to new error codes
mysql-test/suite/maria/maria3.result:
  Updated result
mysql-test/suite/maria/mrr.result:
  Updated result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result:
  Updated result
mysql-test/suite/rpl/r/rpl_auto_increment.result:
  Update to new error codes
mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff:
  Updated results
mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
  Updated results
mysql-test/t/auto_increment.test:
  Update to new error codes
mysql-test/t/auto_increment_ranges.inc:
  Test new behaviour
mysql-test/t/auto_increment_ranges_innodb.test:
  Test new behaviour
mysql-test/t/auto_increment_ranges_myisam.test:
  Test new behaviour
mysql-test/t/replace.test:
  Update to new error codes
mysys/my_getopt.c:
  Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
sql/handler.cc:
  Ignore negative values for signed auto-increment columns
  Always give an error if we get an overflow for an auto-increment-column (instead of inserting the max value)
  Ensure that the row number is correct for the out-of-range-value error message.
  
  
  ******
  Fixed wrong printing of column namn for "Out of range value" errors
  Fixed that INSERT_ID is correctly replicated also for out-of-range autoincrement values
  Fixed that print_keydup_error() can also be used to generate warnings
  ******
  Return HA_ERR_AUTOINC_ERANGE (167) instead of ER_WARN_DATA_OUT_OF_RANGE for auto-increment overflow
sql/handler.h:
  Allow INSERT IGNORE to continue also after out-of-range inserts.
  Fixed that print_keydup_error() can also be used to generate warnings
sql/log_event.cc:
  Added DBUG_PRINT
  Fixed the ER_AUTOINC_READ_FAILED, ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
  This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
sql/sql_insert.cc:
  Add warnings for duplicate key errors when using INSERT IGNORE
sql/sql_state.c:
  Added handler errors
sql/sql_table.cc:
  Update call to print_keydup_error()
storage/innobase/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
storage/xtradb/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
2012-09-18 15:14:19 +03:00
Sergei Golubchik
e4bfb6f161 pbxt suite is now a main-pbxt overlay 2012-02-29 21:55:04 +01:00
Sergei Golubchik
25609313ff 5.3.4 merge 2012-02-15 18:08:08 +01:00
unknown
69327e2987 Adjust test results after Monty's push of the new
handler counter Handler_read_rnd_deleted.
2012-01-18 12:53:50 +02:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Bjorn Munch
d260eded76 Simple fix of suppress pattern in test insert_select 2011-02-16 21:45:52 +01:00
Bjorn Munch
ee2f9d868c Simple fix of suppress pattern in test insert_select 2011-02-16 21:43:12 +01:00
Sergei Golubchik
65ca700def merge.
checkpoint.
does not compile.
2010-11-25 18:17:28 +01:00
Marc Alff
257045499f Bug#52312 lost Handler_read_last status variable
Before this fix, the ha_read_last_count status variable was defined and
updated internally, for never exposed as a system variable.

This fix exposes the system variable as "Handler_read_last",
for completness of the Handler_read_* system variables interface.

Adjusted tests results accordingly.
2010-08-25 13:00:38 -06:00
unknown
a962160eec Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.

This is a re-commit of Monty's merge to eliminate an extra commit from
MySQL-5.1.42 that was accidentally included in the merge.

This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
2009-11-16 21:49:51 +01:00
Sergey Petrunya
29f0dcb563 Merge MySQL->MariaDB
* Finished Monty and Jani's merge
* Some InnoDB tests still fail (because it's old xtradb code run against
  newer testsuite). They are expected to go after mergning with the latest
  xtradb.
2009-09-08 00:50:10 +04:00
Bjorn Munch
29a142043e initial merge from 5.1-mtr 2009-09-04 15:20:58 +02:00
Bjorn Munch
a829604260 first merge from main 2009-09-02 18:58:17 +02:00
Alexey Kopytov
498dc4d32d Manual merge. 2009-07-24 16:09:35 +04:00
Alexey Kopytov
885292e424 Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
In create_myisam_from_heap() mark all errors as fatal except 
HA_ERR_RECORD_FILE_FULL for a HEAP table.

Not doing so could lead to problems, e.g. in a case when a
temporary MyISAM table gets overrun due to its MAX_ROWS limit
while executing INSERT/REPLACE IGNORE ... SELECT. 
The SELECT execution was aborted, but the error was 
converted to a warning due to IGNORE clause, so neither 'ok' 
nor 'error' packet could be sent back to the client. This 
condition led to hanging client when using 5.0 server, or 
assertion failure in 5.1.


mysql-test/r/insert_select.result:
  Added a test case for bug #46075.
mysql-test/t/insert_select.test:
  Added a test case for bug #46075.
sql/sql_select.cc:
  In create_myisam_from_heap() mark all errors as fatal except 
  HA_ERR_RECORD_FILE_FULL for a HEAP table.
2009-07-24 15:50:45 +04:00
Martin Hansson
fdd5a63fe6 Bug#44306: Assertion fail on duplicate key error in
'INSERT ... SELECT' statements
            
The code that produces result rows expected that a duplicate row
error could not occur in INSERT ... SELECT statements with 
unfulfilled WHERE conditions. This may happen, however, if the 
SELECT list contains only aggregate functions.
Fixed by checking if an error occured before trying to send EOF
to the client.


mysql-test/r/insert_select.result:
  Bug#44306: Test result
mysql-test/t/insert_select.test:
  Bug#44306: Test case
sql/sql_select.cc:
  Bug#44306: Fix
2009-05-04 14:45:36 +02:00
unknown
e4cbbcf8a9 Merge sunlight.local:/local_work/27216-bug-5.0-opt-mysql
into  sunlight.local:/local_work/merge-5.1-opt-mysql


libmysql/libmysql.c:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/t/insert_select.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
mysql-test/r/type_datetime.result:
  Manually merged
mysql-test/t/type_datetime.test:
  Manually merged
sql/item_cmpfunc.cc:
  Manually merged
sql/item_cmpfunc.h:
  Manually merged
sql/sql_insert.cc:
  Manually merged
2007-09-24 17:23:40 +04:00
unknown
f7f1095908 Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
led to creating corrupted index.

While execution of the  CREATE .. SELECT SQL_BUFFER_RESULT statement the 
engine->start_bulk_insert function was called twice. On the first call
On the first call MyISAM disabled all non-unique indexes and on the second
call it decides to not re-enable them because all indexes was disabled.
Due to this no indexes was actually created during CREATE TABLE thus
producing crashed table.

Now the select_inset class has is_bulk_insert_mode flag which prevents
calling the start_bulk_insert function twice.
The flag is set in the select_create::prepare, select_insert::prepare2
functions and the select_insert class constructor.
The flag is reset in the select_insert::send_eof function.


mysql-test/t/insert_select.test:
  A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the
  CREATE .. KEY(..) .. SELECT led to creating corrupted index.
mysql-test/r/insert_select.result:
  A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the 
  CREATE .. KEY(..) .. SELECT led to creating corrupted index.
sql/sql_class.h:
  Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
  led to creating corrupted index.
  The is_bulk_insert_mode flag is added to the select_insert class.
sql/sql_insert.cc:
  Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
  led to creating corrupted index.
  The is_bulk_insert_mode is set in the select_create::prepare, select_insert::prepare2
  functions and the select_insert class constructor.
  The flag is reset in the select_insert::send_eof function.
2007-09-21 12:09:00 +04:00
unknown
f1ed9bc67e Merge mysql.com:/home/hf/work/29717/my50-29717
into  mysql.com:/home/hf/work/29717/my51-29717


mysql-test/r/group_by.result:
  Auto merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/t/group_by.test:
  Auto merged
mysql-test/t/insert_select.test:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_select.h:
  Auto merged
2007-07-31 11:12:23 +05:00
unknown
210243480c merging 2007-07-31 11:10:03 +05:00
unknown
26b526dc60 Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.1-opt


libmysql/libmysql.c:
  Merge with 5.0-opt.
mysql-test/r/insert_select.result:
  Merge with 5.0-opt.
mysql-test/r/mysqlbinlog.result:
  Merge with 5.0-opt.
mysql-test/r/rpl_change_master.result:
  Merge with 5.0-opt.
mysql-test/r/view.result:
  Merge with 5.0-opt.
mysql-test/t/insert_select.test:
  Merge with 5.0-opt.
mysql-test/t/mysqlbinlog.test:
  Merge with 5.0-opt.
mysql-test/t/rpl_change_master.test:
  Merge with 5.0-opt.
mysql-test/t/view.test:
  Merge with 5.0-opt.
sql/item.cc:
  Merge with 5.0-opt.
sql/item.h:
  Merge with 5.0-opt.
sql/log_event.cc:
  Merge with 5.0-opt.
sql/sql_select.cc:
  Merge with 5.0-opt.
2007-06-24 03:35:27 +05:00
unknown
1bab1ddc55 Fixed bug #29095.
INSERT into table from SELECT from the same table
with ORDER BY and LIMIT was inserting other data
than sole SELECT ... ORDER BY ... LIMIT returns.

One part of the patch for bug #9676 improperly pushed
LIMIT to temporary table in the presence of the ORDER BY
clause.
That part has been removed.


sql/sql_select.cc:
  Fixed bug #29095.
  One part of the patch for bug #9676 improperly pushed
  LIMIT to temporary table in the presence of the ORDER BY
  clause.
  That part has been removed.
mysql-test/t/insert_select.test:
  Expanded the test case for bug #9676.
  Created a test case for bug #29095.
mysql-test/r/insert_select.result:
  Expanded the test case for bug #9676.
  Created a test case for bug #29095.
2007-06-24 01:20:14 +05:00
unknown
11b084102d backport of Bug#11491 Misleading error message if not NULL column set to NULL, SQL mode TRADITIONAL
mysql-test/r/auto_increment.result:
  result fix
mysql-test/r/create.result:
  result fix
mysql-test/r/insert.result:
  result fix
mysql-test/r/insert_select.result:
  result fix
mysql-test/r/insert_update.result:
  result fix
mysql-test/r/key.result:
  result fix
mysql-test/r/null.result:
  result fix
mysql-test/r/null_key.result:
  result fix
mysql-test/r/ps_2myisam.result:
  result fix
mysql-test/r/ps_3innodb.result:
  result fix
mysql-test/r/ps_4heap.result:
  result fix
mysql-test/r/ps_5merge.result:
  result fix
mysql-test/r/ps_6bdb.result:
  result fix
mysql-test/r/ps_7ndb.result:
  result fix
mysql-test/r/strict.result:
  result fix
mysql-test/r/view.result:
  result fix
mysql-test/r/warnings.result:
  result fix
mysql-test/t/strict.test:
  test fix
2007-05-30 17:04:04 +05:00
unknown
2c5395eedb Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt


mysql-test/r/insert_select.result:
  Auto merged
mysql-test/t/insert_select.test:
  Auto merged
sql/field.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_select.h:
  Auto merged
mysql-test/r/create.result:
  merging
mysql-test/r/temp_table.result:
  SCCS merged
mysql-test/r/type_float.result:
  merging
mysql-test/r/union.result:
  merging
mysql-test/t/temp_table.test:
  merging
2007-03-22 23:59:20 +04:00
unknown
0a48cd93b4 Bug #26207: When making the key image to use
in index search MySQL was not explicitly
 suppressing warnings. And if the context 
 happens to enable warnings (e.g. INSERT ..
 SELECT) the warnings resulting from converting 
 the data the key is compared to are 
 reported to the client.
 Fixed by suppressing warnings when converting
 the data to the same type as the key parts.


mysql-test/r/insert_select.result:
  Bug #26207: test case
mysql-test/t/insert_select.test:
  Bug #26207: test case
sql/sql_select.h:
  Bug #26207: supress warnings when converting
    data of the same type to key buffer format.
2007-03-22 18:44:16 +02:00
unknown
bab42f674d after merge fix 2007-02-26 16:52:54 +04:00
unknown
b10600528d Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt


mysql-test/r/innodb.result:
  Auto merged
mysql-test/r/insert_update.result:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/subselect3.result:
  Auto merged
mysql-test/r/type_blob.result:
  Auto merged
mysql-test/t/insert_update.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
BitKeeper/deleted/.del-bdb.result:
  Auto merged
mysql-test/extra/binlog_tests/blackhole.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
storage/blackhole/ha_blackhole.cc:
  Auto merged
mysql-test/r/binlog_stm_blackhole.result:
  manual merge
mysql-test/r/insert_select.result:
  manual merge
mysql-test/r/subselect.result:
  manual merge
mysql-test/r/update.result:
  manual merge
mysql-test/t/insert_select.test:
  manual merge
mysql-test/t/subselect.test:
  manual merge
sql/sql_help.cc:
  manual merge
sql/sql_insert.cc:
  manual merge
sql/sql_update.cc:
  manual merge
2007-02-26 15:54:43 +04:00
unknown
d5813a06f6 Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
UPDATE contains wrong data if the SELECT employs a temporary table.

If the UPDATE values of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE
statement contains fields from the SELECT part and the select employs a
temporary table then those fields will contain wrong values because they
aren't corrected to get data from the temporary table.

The solution is to add these fields to the selects all_fields list,
to store pointers to those fields in the selects ref_pointer_array and
to access them via Item_ref objects.

The substitution for Item_ref objects is done in the new function called 
Item_field::update_value_transformer(). It is called through the
item->transform() mechanism at the end of the select_insert::prepare()
function.


sql/item.cc:
  Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
  UPDATE contains wrong data if the SELECT employs a temporary table.
  The new method Item_field::update_value_transformer() is added. It
  substitutes fields in the update values list for references 
  (Item_ref objects) to them.
sql/item.h:
  Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
  UPDATE contains wrong data if the SELECT employs a temporary table.
  The update_value_transformer() method is added to the Item and to the
  Item_field classes.
sql/sql_insert.cc:
  Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
  UPDATE contains wrong data if the SELECT employs a temporary table.
  Traverse update values and substitute fields from the select for
  references (Item_ref objects) to them.
sql/sql_select.cc:
  Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY
  UPDATE contains wrong data if the SELECT employs a temporary table.
  Traverse update values and substitute fields from the select for
  references (Item_ref objects) to them.
mysql-test/r/insert_select.result:
  Added a test case for bug#16630: The update fields of the INSERT .. SELECT ..
  ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a 
  temporary table.
mysql-test/t/insert_select.test:
  Added a test case for bug#16630: The update fields of the INSERT .. SELECT ..
  ON DUPLICATE KEY UPDATE contains wrong data if the SELECT employs a 
  temporary table.
2007-02-16 19:39:28 +03:00
unknown
4c9d090adc Post-merge fix. 2007-02-13 13:15:23 -08:00
unknown
21df932dbd Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into  olga.mysql.com:/home/igor/mysql-5.1-opt


BitKeeper/etc/gone:
  auto-union
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/select.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/insert_select.test:
  Auto merged
mysql-test/t/join_outer.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
mysys/my_getopt.c:
  Auto merged
sql/field.h:
  Auto merged
sql/field_conv.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/include/mix1.inc:
  Manual merge
mysql-test/r/information_schema.result:
  Manual merge
mysql-test/r/innodb_mysql.result:
  Manual merge
mysql-test/t/information_schema.test:
  Manual merge
mysql-test/t/view.test:
  Manual merge
mysys/my_pthread.c:
  Manual merge
sql/mysql_priv.h:
  Manual merge
sql/opt_range.cc:
  Manual merge
sql/sql_insert.cc:
  Manual merge
sql/sql_update.cc:
  Manual merge
2007-02-13 01:34:36 -08:00
unknown
dd6feec4f4 Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were
inserted.

The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
no rows were inserted.


mysql-test/t/insert_select.test:
  Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were inserted.
mysql-test/r/insert_select.result:
  Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were inserted.
sql/sql_insert.cc:
  Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were
  inserted.The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
  no rows were inserted.
2007-02-09 22:25:09 +03:00
unknown
976f0a391c Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
updated.

INSERT ... ON DUPLICATE KEY UPDATE reports that a record was updated when
the duplicate key occurs even if the record wasn't actually changed
because the update values are the same as those in the record.

Now the compare_record() function is used to check whether the record was
changed and the update of a record reported only if the record differs
from the original one.


sql/sql_update.cc:
  Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
  updated.
  The compare_record() function was changed to non-static one.
sql/sql_insert.cc:
  Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
  updated.
  Now the compare_record() function is used to check whether the record was
  changed and the update of a record reported only if the record differs
  from the original one.
sql/mysql_priv.h:
  Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
  updated.
  Added the prototype of the compare_record() function.
mysql-test/t/insert_select.test:
  Added a test case for bug#19978: INSERT .. ON DUPLICATE erroneously reports
  some records were updated.
mysql-test/r/insert_select.result:
  Added a test case for bug#19978: INSERT .. ON DUPLICATE erroneously reports
  some records were updated.
2007-02-07 00:46:03 +03:00
unknown
298aff1267 Merge mysql.com:/home/hf/work/embt/my50-embt
into  mysql.com:/home/hf/work/embt/my51-embt


libmysqld/lib_sql.cc:
  Auto merged
BitKeeper/deleted/.del-bdb.result:
  Auto merged
BitKeeper/deleted/.del-bdb.test:
  Auto merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/r/join.result:
  Auto merged
mysql-test/t/backup.test:
  Auto merged
mysql-test/t/delayed.test:
  Auto merged
mysql-test/t/join.test:
  Auto merged
mysql-test/t/status.test:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
mysql-test/mysql-test-run.pl:
  merging
mysql-test/r/flush_block_commit.result:
  SCCS merged
mysql-test/r/insert.result:
  merging
mysql-test/t/innodb.test:
  merging
mysql-test/t/insert.test:
  merging
sql/share/errmsg.txt:
  merging
2006-11-13 20:16:46 +04:00
unknown
ea1f7e4b56 several fixes to make tests pass in embedded-server mode
libmysqld/lib_sql.cc:
  check for bootstrap added
mysql-test/include/federated.inc:
  disabled in embedded
mysql-test/mysql-test-run.pl:
  we disable ssh in embedded server
mysql-test/r/bdb.result:
  part moved to bdb_notembedded as it uses binlog
mysql-test/r/flush_block_commit.result:
  part moved to flush_block_commit_notembedded
mysql-test/r/insert.result:
  part moved to insert_notembedded as delayed works differently in embedded server
mysql-test/r/insert_select.result:
  part moved to insert_notembedded as GRANTS usually disabled in embedded server
mysql-test/r/join.result:
  access rights hidden in result
mysql-test/t/backup.test:
  now available in embedded server
mysql-test/t/bdb.test:
  part moved to bdb_notembedded as it uses binlog
mysql-test/t/delayed.test:
  code trimmed
mysql-test/t/execution_constants.test:
  skipped in embedded-server mode
mysql-test/t/flush_block_commit.test:
  moved to flush_block_commit_notembedded
mysql-test/t/information_schema_db.test:
  skipped in embedded-server
mysql-test/t/innodb.test:
  directories replaced to be embedded-server compliant
mysql-test/t/insert.test:
  part moved to insert_notembedded
mysql-test/t/insert_select.test:
  part moved to insert_notembedded
mysql-test/t/join.test:
  access rights hidden
mysql-test/t/status.test:
  skipped in embedded server
mysql-test/t/trigger.test:
  directories replaced to be embedded-server compliant
sql/item_strfunc.cc:
  extra contexts not needed whan access checks disabled
sql/share/errmsg.txt:
  bigger paths reserved to prevent test's fails
mysql-test/r/bdb_notembedded.result:
  ***MISSING WEAVE***
mysql-test/r/flush_block_commit_notembedded.result:
  added
mysql-test/r/insert_notembedded.result:
  added
mysql-test/t/bdb_notembedded.test:
  ***MISSING WEAVE***
mysql-test/t/flush_block_commit_notembedded.test:
  added
mysql-test/t/insert_notembedded.test:
  added
2006-11-13 20:06:45 +04:00
unknown
6a490444a6 Merge lamia.home:/home/timka/mysql/src/5.0-bug-21774-sm
into  lamia.home:/home/timka/mysql/src/5.1-dbg


mysql-test/r/insert_select.result:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
2006-09-13 15:22:50 +03:00
unknown
900e66f895 Fix for BUG#21774: Column count doesn't match value count at row x
The cause of the bug was an incomplete fix for bug 18080.
The problem was that setup_tables() unconditionally reset the
name resolution context to its 'tables' argument, which pointed
to the first table of an SQL statement.

The bug fix limits resetting of the name resolution context in
setup_tables() only in the cases when the context was not set
by earlier parser/optimizer phases.


mysql-test/r/insert_select.result:
  Test for BUG#21774.
mysql-test/t/insert_select.test:
  Test for BUG#21774.
sql/sql_base.cc:
  Do not reset the name resolution contect unconditionally.
  Instead set the context to 'tables' only if it was not
  set before calling setup_tables().
sql/sql_insert.cc:
  Added asserts to make sure that in the case of INSERT ... VALUES ...
  statements it is not necessary to reset the name resolution context
  to the first table, because there is only one table in the list of
  tables anyway. The actual code is not removed in order not to
  confuse it with the actual bug fix.
sql/sql_parse.cc:
  Removed unnecessary reset of the name resolution context.
  The context is anyway unconditionally reset in mysql_insert()
  and mysql_prepare_insert().
2006-09-12 17:50:24 +03:00
unknown
131f9a71d1 Merge xiphis.org:/home/antony/work2/mysql-5.0-engines
into  xiphis.org:/home/antony/work2/mysql-5.0-merge


mysql-test/r/create.result:
  Auto merged
mysql-test/r/federated.result:
  Auto merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/r/ps_2myisam.result:
  Auto merged
mysql-test/r/ps_3innodb.result:
  Auto merged
mysql-test/r/ps_4heap.result:
  Auto merged
mysql-test/r/ps_5merge.result:
  Auto merged
mysql-test/r/ps_6bdb.result:
  Auto merged
mysql-test/r/ps_7ndb.result:
  Auto merged
mysql-test/r/strict.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/r/warnings.result:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
2006-08-14 21:27:36 -07:00
unknown
eafb760579 Merge maint1.mysql.com:/data/localhome/tsmith/bk/mrg50-b
into  maint1.mysql.com:/data/localhome/tsmith/bk/mrg51-b


mysql-test/r/insert_select.result:
  SCCS merged
sql/sql_insert.cc:
  SCCS merged
2006-08-03 10:18:04 +02:00
unknown
a1bd0bd118 BUG#14770 - LOAD DATA INFILE doesn't respect default values for
columns
Fixed confusing warning.

Quoting INSERT section of the manual:
----
Inserting NULL into a column that has been declared NOT NULL. For
multiple-row INSERT statements or INSERT INTO ... SELECT statements, the
column is set to the implicit default value for the column data type. This
is 0 for numeric types, the empty string ('') for string types, and the
"zero" value for date and time types. INSERT INTO ... SELECT statements are
handled the same way as multiple-row inserts because the server does not
examine the result set from the SELECT to see whether it returns a single
row. (For a single-row INSERT, no warning occurs when NULL is inserted into
a NOT NULL column. Instead, the statement fails with an error.)
----
This is also true for LOAD DATA INFILE. For INSERT user can specify
DEFAULT keyword as a value to set column default. There is no similiar
feature available for LOAD DATA INFILE.


mysql-test/r/auto_increment.result:
  Fixed confusing warning.
mysql-test/r/create.result:
  Fixed confusing warning.
mysql-test/r/insert.result:
  Fixed confusing warning.
mysql-test/r/insert_select.result:
  Fixed confusing warning.
mysql-test/r/key.result:
  Fixed confusing warning.
mysql-test/r/null.result:
  Fixed confusing warning.
mysql-test/r/null_key.result:
  Fixed confusing warning.
mysql-test/r/ps_2myisam.result:
  Fixed confusing warning.
mysql-test/r/ps_3innodb.result:
  Fixed confusing warning.
mysql-test/r/ps_4heap.result:
  Fixed confusing warning.
mysql-test/r/ps_5merge.result:
  Fixed confusing warning.
mysql-test/r/ps_6bdb.result:
  Fixed confusing warning.
mysql-test/r/strict.result:
  Fixed confusing warning.
mysql-test/r/view.result:
  Fixed confusing warning.
mysql-test/r/warnings.result:
  Fixed confusing warning.
sql/share/errmsg.txt:
  Fixed confusing warning.
2006-08-02 17:15:50 +05:00
unknown
c185144609 Bug#20989: View '(null).(null)' references invalid table(s)... on SQL SECURITY INVOKER
REPLACE ... SELECT would require INSERT privileges on certain tables
when SELECT really suffices. Require INSERT only on target table.


mysql-test/r/insert_select.result:
  Bug#20989: View '(null).(null)' references invalid table(s)... on SQL SECURITY INVOKER
  
  Show that REPLACE ... SELECT requires INSERT privileges only on target table.
  (revised test with more view-fu)
mysql-test/t/insert_select.test:
  Bug#20989: View '(null).(null)' references invalid table(s)... on SQL SECURITY INVOKER
  
  Show that REPLACE ... SELECT requires INSERT privileges only on target table.
  (revised test with more view-fu)
sql/sql_insert.cc:
  Bug#20989: View '(null).(null)' references invalid table(s)... on SQL SECURITY INVOKER
  
  require SELECT rather than INSERT privs on tables that constitute the views we'll read
2006-07-19 11:49:07 +02:00
unknown
a68075513a Manual merge
mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/r/key.result:
  Auto merged
mysql-test/r/view_grant.result:
  Auto merged
mysql-test/t/key.test:
  Auto merged
mysql-test/t/view_grant.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
2006-06-28 19:34:04 +04:00
unknown
c2575322c6 Merge mysql.com:/home/emurphy/src/bk-clean/tmp_merge
into  mysql.com:/home/emurphy/src/bk-clean/mysql-5.1


mysql-test/mysql-test-run.sh:
  Auto merged
mysql-test/valgrind.supp:
  Auto merged
mysql-test/r/func_str.result:
  Auto merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
mysql-test/t/select.test:
  Auto merged
mysys/Makefile.am:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/opt_sum.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Auto merged
storage/ndb/src/ndbapi/ndberror.c:
  Auto merged
include/Makefile.am:
  manual merge
mysql-test/r/func_time.result:
  manual merge
mysql-test/r/select.result:
  manual merge
2006-06-25 09:59:34 -04:00
unknown
b92ad63f99 merge of the changes for bug #18080
mysql-test/t/insert_select.test:
  Auto merged
mysql-test/r/insert_select.result:
  manual merge
2006-06-21 13:03:06 +03:00
unknown
4d3803f0ed Manually merged
mysql-test/r/insert_select.result:
  Auto merged
mysql-test/t/insert_select.test:
  Auto merged
2006-06-20 22:22:14 +04:00
unknown
b7e27e80d9 Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
There was an incomplete reset of the name resolution context, that caused 
INSERT ... SELECT ... JOIN statements to resolve not by joint row type calculated
for the join.
Removed the redundant re-initialization of the context, because 
mysql_insert_select_prepare() now correctly saves/restores the context.


mysql-test/r/insert_select.result:
  Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
  
  - testsuite for the bug
mysql-test/t/insert_select.test:
  Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
  
  - testsuite for the bug
sql/sql_parse.cc:
  Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
  
  - remove an incomplete reset of the context because the mentioned function
  correctly saves/restores the context.
2006-06-19 17:34:12 +03:00
unknown
a9ac0557db Merge mysql.com:/home/kgeorge/mysql/4.1/B9676
into  mysql.com:/home/kgeorge/mysql/5.0/B9676


mysql-test/r/insert_select.result:
  Auto merged
mysql-test/t/insert_select.test:
  Auto merged
sql/sql_select.cc:
  SCCS merged
2006-06-19 13:31:11 +03:00
unknown
124cb126fa * Bug #9676: INSERT INTO x SELECT .. FROM x LIMIT 1; slows down with big
tables
Currently in INSERT ... SELECT ... LIMIT ... the compiler uses a 
temporary table to store the results of SELECT ... LIMIT .. and then
uses that table as a source for INSERT. The problem is that in some cases
it actually skips the LIMIT clause in doing that and materializes the 
whole SELECT result set regardless of the LIMIT.
This fix is limiting the process of filling up the temp table with only 
that much rows that will be actually used by propagating the LIMIT value.


mysql-test/r/insert_select.result:
  * Bug #9676: INSERT INTO x SELECT .. FROM x LIMIT 1; slows down with big
                tables
  - a test demonstrating the code path
mysql-test/t/insert_select.test:
  * Bug #9676: INSERT INTO x SELECT .. FROM x LIMIT 1; slows down with big
                tables
  - a test demonstrating the code path
sql/sql_select.cc:
  * Bug #9676: INSERT INTO x SELECT .. FROM x LIMIT 1; slows down with big
                tables
  - pass through the real LIMIT number if the temp table is created for
    buffering results.
  - set the counter for all the cases when the temp table is not used for
    grouping
2006-06-19 13:22:42 +03:00
unknown
0369042a09 WL#1563 - Modify MySQL to support fast CREATE/DROP INDEX
Change "duplicate key" message to print key name
instead of key number.
2006-01-23 12:17:05 +01:00
unknown
c86ba5f5e7 Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
  Message is chenged from 'ER_WARN_NULL_TO_NOTNULL' to 'ER_BAD_NULL_ERROR'


mysql-test/r/auto_increment.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/create.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/insert.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/insert_select.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/key.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/null.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/null_key.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/ps_2myisam.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/ps_3innodb.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/ps_4heap.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/ps_5merge.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/ps_6bdb.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/ps_7ndb.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/strict.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/view.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/r/warnings.result:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    result change
mysql-test/t/strict.test:
  Fix for bug#11491 Misleading error message if not NULL column set to NULL,
                    SQL mode TRADITIONAL
    test change
2005-12-01 15:30:11 +04:00
unknown
1b574f5bdf Merge 4.1 - 5.0
mysql-test/r/insert_select.result:
  Merge from 4.1 to 5.0.
mysql-test/r/select.result:
  Merge from 4.1 to 5.0.
mysql-test/t/insert_select.test:
  Merge from 4.1 to 5.0.
mysys/my_handler.c:
  Merge from 4.1 to 5.0.
sql/item.cc:
  Merge from 4.1 to 5.0.
sql/item_timefunc.cc:
  Imported bug fix from 4.1 to 5.0. (Bug#14016)
sql/item_timefunc.h:
  Imported bug fix from 4.1 to 5.0. (Bug#14016)
2005-10-28 02:36:19 +03:00