Commit graph

583 commits

Author SHA1 Message Date
Chad MILLER
dae4c823e9 Merge from 5.0 trunk. 2008-07-14 16:16:37 -04:00
Chad MILLER
c94a46240a Merge chunk from trunk. 2008-07-10 14:50:07 -04:00
Chad MILLER
06756c19c5 Merge chunk from trunk. 2008-07-10 14:47:53 -04:00
mattiasj@witty.
16e83e55e6 Merge witty.:/Users/mattiasj/Public/shared-vms/bug21413-41-engines
into  witty.:/Users/mattiasj/clones/bug21413-50-engines
2008-03-27 16:24:11 +01:00
mattiasj@witty.
c87874a1a3 Recommit of antonys previous commit.
Bug#21413
"Engine table handler used by multiple threads in REPLACE DELAYED"
When executing a REPLACE DELAYED statement, the storage engine
::extra() method was invoked by a different thread than the thread
which has acquired the handler instance.

This did not cause problems within the current server and with
the current storage engines.
But it has the potential to confuse future storage engines.

Added code to avoid surplus calls to extra() method in case of DELAYED
which avoids calling storage engine from a different thread than
expected.

No test case.
This change does not change behavior in conjunction with current
storage engines. So it cannot be tested by the regression test suite.
2008-03-27 01:13:39 +01:00
kaa@kaamos.(none)
80d89023ea Fix for bug #34889: mysql_client_test::test_mysql_insert_id test fails
sporadically

Under some circumstances, the mysql_insert_id() value after SELECT ...
INSERT could return a wrong value. This could happen when the last
SELECT ... INSERT did not involve an AUTO_INCREMENT column, but the
value of mysql_insert_id() was changed by some previous statements.

Fixed by checking the value of thd->insert_id_used in
select_insert::send_eof() and returning 0 for mysql_insert_id() if it
is not set.
2008-03-05 16:02:33 +03:00
evgen@moonbone.local
baaf300d4c Bug#29477: Not all fields of the target table were checked to have a default
value when inserting into a view.

The mysql_prepare_insert function checks all fields of the target table that
directly or indirectly (through a view) are specified in the INSERT
statement to have a default value. This check can be skipped if the INSERT
statement doesn't mention any insert fields. In case of a view this allows
fields that aren't mentioned in the view to bypass the check.

Now fields of the target table are always checked to have a default value
when insert goes into a view.
2008-01-11 20:10:54 +03:00
gluh@eagle.(none)
e039595029 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-12-13 14:52:49 +04:00
cmiller@zippy.cornsilk.net
a35a8fe550 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-12-10 15:28:17 -05:00
kaa@polly.(none)
cf39abbbd6 Merge polly.(none):/home/kaa/src/opt/bug9481/my50-bug9481
into  polly.(none):/home/kaa/src/opt/mysql-5.0-opt
2007-11-30 18:45:35 +03:00
ramil/ram@ramil.myoffice.izhnet.ru
92d4ea79ef Merge mysql.com:/home/ram/work/mysql-5.0-engines
into  mysql.com:/home/ram/work/b32676/b32676.5.0
2007-11-29 08:24:52 +04:00
kaa@polly.(none)
24c9d86416 5.0 version of the fix for bug #9481: mysql_insert_id() returns 0 after
insert ... select.

The 5.0 manual page for mysql_insert_id() does not mention anything
about INSERT ... SELECT, though its current behavior is incosistent
with what the manual says about the plain INSERT.

Fixed by changing the AUTO_INCREMENT and mysql_insert_id() handling
logic in INSERT ... SELECT to be consistent with the INSERT behavior,
the manual, and the changes in 5.1 introduced by WL3146:


- mysql_insert_id() now returns the first automatically generated
AUTO_INCREMENT value that was successfully inserted by INSERT ... SELECT

-  if an INSERT ... SELECT statement is executed, and no automatically
generated value is successfully inserted, mysql_insert_id() now returns
the ID of the last inserted row.
2007-11-26 18:36:05 +03:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
5adf16e288 Fix for bug #32676: insert delayed crash with wrong column and function specified
Problem: using wrong local lock type value in the mysql_insert() results in a crash. 

Fix: use a proper value.
2007-11-26 13:29:26 +04:00
evgen@moonbone.local
da7470afb1 Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
led to creating corrupted index.

Corrected fix. The new method called prepare2 is added to the select_create
class. As all preparations are done by the select_create::prepare function
it doesn't do anything. Slightly changed algorithm of calling the 
start_bulk_insert function. Now it's called from the select_insert::prepare2
function when the SQL_BUFFER_RESULT flags is set.
The is_bulk_insert_mode flag is removed as it is not needed anymore.
2007-11-19 21:05:17 +00:00
aelkin/elkin@koti.dsl.inet.fi
355c6a2deb Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  koti.dsl.inet.fi:/home/elkin/MySQL/TEAM/FIXES/5.0/bug27571_asyn_killed_flags
2007-11-06 13:27:48 +02:00
bar@bar.myoffice.izhnet.ru
628b462881 Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/bar/mysql-work/mysql-5.0-rpl-merge
2007-10-30 12:21:44 +04:00
aelkin/elkin@koti.dsl.inet.fi
27436f0ba3 Bug #27571 asynchronousity in setting mysql_query::error and
Query_log_event::error_code

A query can perform completely having the local var error of mysql_$query
zero, where $query in insert, update, delete, load,
and be  binlogged with error_code e.g KILLED_QUERY while there is no
reason do to so.
That can happen because Query_log_event consults thd->killed flag to
evaluate error_code.

Fixed with implementing a scheme suggested and partly implemented at
time of bug@22725 work-on. error_status is cached immediatly after the
control leaves the main rows-loop and that instance always corresponds
to `error' the local of mysql_$query functions. The cached value
is passed to Query_log_event constructor, not the default thd->killed
which can be changed in between of the caching and the constructing.
2007-10-29 15:20:59 +02:00
gkodinov/kgeorge@magare.gmz
bbe1d37089 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30468-5.0-opt
2007-09-27 12:17:16 +03:00
gkodinov/kgeorge@magare.gmz
fb3b12176d Bug #30468: column level privileges not respected when joining tables
When expanding a * in a USING/NATURAL join the check for table access
for both tables in the join was done using the grant information of the
first one.
Fixed by getting the grant information for the current table while 
iterating through the columns of the join.
2007-09-27 12:15:19 +03:00
evgen@sunlight.local
7ed30b971c Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  sunlight.local:/local_work/27216-bug-5.0-opt-mysql
2007-09-22 13:10:44 +04:00
evgen@sunlight.local
36bf417b40 Bug#27216: functions with parameters of different date types may return wrong
type of the result.

There are several functions that accept parameters of different types.
The result field type of such functions was determined based on
the aggregated result type of its arguments. As the DATE and the DATETIME
types are represented by the STRING type, the result field type
of the affected functions was always STRING for DATE/DATETIME arguments.
The affected functions are COALESCE, IF, IFNULL, CASE, LEAST/GREATEST, CASE.

Now the affected functions aggregate the field types of their arguments rather
than their result types and return the result of aggregation as their result
field type.
The cached_field_type member variable is added to the number of classes to
hold the aggregated result field type.
The str_to_date() function's result field type now defaults to the
MYSQL_TYPE_DATETIME.
The agg_field_type() function is added. It aggregates field types with help
of the Field::field_type_merge() function.
The create_table_from_items() function now uses the 
item->tmp_table_field_from_field_type() function to get the proper field
when the item is a function with a STRING result type.
2007-09-22 11:49:27 +04:00
evgen@sunlight.local
bb5cdfb87e 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.
2007-09-21 12:09:00 +04:00
cmiller@zippy.cornsilk.net
cf74e43f15 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-09-10 08:06:27 -04:00
lars/lthalmann@dl145h.mysql.com
4f29c65ae1 Merge mysql.com:/nfsdisk1/lars/bkroot/mysql-5.0-rpl
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
2007-09-10 13:15:04 +02:00
davi@moksha.local
1180c22aef Bug#28587 SELECT is blocked by INSERT waiting on read lock, even with low_priority_updates
The problem is that a SELECT on one thread is blocked by INSERT ... ON
DUPLICATE KEY UPDATE on another thread even when low_priority_updates is
activated.

The solution is to possibly downgrade the lock type to the setting of
low_priority_updates if the INSERT cannot be concurrent.
2007-08-30 16:11:53 -03:00
aelkin/elkin@dsl-hkibras-fe38f900-157.dhcp.inet.fi
77998c30c2 Bug #23333 stored function + non-transac table + transac table = breaks stmt-based binlog
Binlogging of the statement with a side effect like a modified non-trans table did not happen.
The artifact involved all binloggable dml queries.

Fixed with changing the binlogging conditions all over the code to exploit thd->transaction.stmt.modified_non_trans_table
introduced by the patch for bug@27417.

Multi-delete case has own specific addressed by another bug@29136. Multi-update case has been addressed by bug#27716 and
patch and will need merging.
2007-08-21 15:16:55 +03:00
istruewing@chilla.local
91e9aeb88d Merge chilla.local:/home/mydev/mysql-5.0-amain
into  chilla.local:/home/mydev/mysql-5.0-axmrg
2007-08-03 06:56:04 +02:00
svoj@mysql.com/april.(none)
2c539642c0 BUG#29152 - INSERT DELAYED does not use concurrent_insert on slave
INSERT DELAYED on a replication slave was converted to regular INSERT,
whereas it should try concurrent INSERT first.

With this patch we try to convert delayed insert to concurrent insert on
a replication slave. If it is impossible for some reason, we fall back to
regular insert.

No test case for this fix. I do not see anything indicating this is
regression - we behave this way since Nov 2000.
2007-07-31 19:40:36 +05:00
gkodinov/kgeorge@magare.gmz
9a0e6ec6d2 (pushing for Andrei)
Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
  
Once had been set the flag might later got reset inside of a stored routine 
execution stack.
The reason was in that there was no check if a new statement started at time 
of resetting.
The artifact affects most of binlogable DML queries. Notice, that multi-update 
is wrapped up within
  bug@27716 fix, multi-delete bug@29136.
  
Fixed with saving parent's statement flag of whether the statement modified 
non-transactional table, and unioning (merging) the value with that was gained 
in mysql_execute_command.
  
Resettling thd->no_trans_update members into thd->transaction.`member`;
Asserting code;
Effectively the following properties are held.
  
1. At the end of a substatement thd->transaction.stmt.modified_non_trans_table
   reflects the fact if such a table got modified by the substatement.
   That also respects THD::really_abort_on_warnin() requirements.
2. Eventually thd->transaction.stmt.modified_non_trans_table will be computed as
   the union of the values of all invoked sub-statements.
   That fixes this bug#27417;

Computing of thd->transaction.all.modified_non_trans_table is refined to base to 
the stmt's value for all the case including insert .. select statement which 
before the patch had an extra issue bug@28960.
Minor issues are covered with mysql_load, mysql_delete, and binloggin of insert in
to temp_table select. 
  
The supplied test verifies limitely, mostly asserts. The ultimate testing is defered
for bug@13270, bug@23333.
2007-07-30 18:27:36 +03:00
gkodinov/kgeorge@magare.gmz
9bc5e92614 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B29571-5.0-opt
2007-07-26 11:32:27 +03:00
gkodinov/kgeorge@magare.gmz
02fe5e27d2 Bug #29571: INSERT DELAYED IGNORE written to binary log on
the master but on the slave

MySQL can decide to "downgrade" a INSERT DELAYED statement
to normal insert in certain situations.
One such situation is when the slave is replaying a 
replication feed.
However INSERT DELAYED is logged even if there're no updates
whereas the NORMAL INSERT is not logged in such cases.

Fixed by always logging a "downgraded" INSERT DELAYED: even 
if there were no updates.
2007-07-26 11:31:10 +03:00
kostja@bodhi.(none)
c4bcce64a4 Rename all references to 'Delayed_insert' instances from 'tmp' to 'di'
for consistency.
2007-07-19 19:36:52 +04:00
kostja@bodhi.(none)
1aae30060e A fix for Bug#29431 killing an insert delayed thread causes crash
No test case, since the bug requires a stress case with 30 INSERT DELAYED
threads and 1 killer thread to repeat. The patch is verified
manually.
Review fixes.

The server that is running DELAYED inserts would deadlock itself
or crash under high load if some of the delayed threads were KILLed
in the meanwhile.

The fix is to change internal lock acquisition order of delayed inserts
subsystem and to ensure that
Delayed_insert::table_list::db does not point to volatile memory in some 
cases.
For details, please see a comment for sql_insert.cc.
2007-07-19 19:28:00 +04:00
antony@ppcg5.local
2b52524ea5 Merge anubis.xiphis.org:/usr/home/antony/work/mysql-5.0-engines
into  anubis.xiphis.org:/usr/home/antony/work/mysql-5.0-engines.merge
2007-07-06 09:00:40 -07:00
cmiller@zippy.cornsilk.net
681ee9694b Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
2007-07-02 10:46:46 -04:00
antony@ppcg5.local
b0b0b0fbc4 Bug#25511
"Federated INSERT failures"
  Federated does not correctly handle "INSERT...ON DUPLICATE KEY UPDATE"
  However, implementing such support is not reasonably possible without
  increasing complexity of the storage engine: checking that constraints
  on remote server match local server and parsing error messages.
  This patch causes 'ON DUPLICATE KEY' to fail with ER_DUP_KEY message
  if a conflict occurs and not to fail silently.
2007-06-28 13:36:26 -07:00
mhansson@dl145s.mysql.com
a90ff73738 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/dev/shm/mhansson/my50-bug28677
2007-06-27 14:02:32 +02:00
mhansson/martin@linux-st28.site
cc2d534ab1 Bug#28677: SELECT on missing column gives extra error
The method select_insert::send_error does two things, it rolls back a statement
being executed and outputs an error message. But when a 
nonexistent column is referenced, an error message has been published already and
there is no need to publish another.
Fixed by moving all functionality beyond publishing an error message into 
select_insert::abort() and calling only that function.
2007-06-18 16:35:01 +03:00
evgen@moonbone.local
4cdbe25a6b Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it shouldn't.
When the INSERT .. ON DUPLICATE KEY UPDATE has to update a matched row but
the new data is the same as in the record then it returns as if
no rows were inserted or updated. Nevertheless the row is silently
updated. This leads to a situation when zero updated rows are reported 
in the case when data has actually been changed.

Now the write_record function updates a row only if new data differs from
that in the record.
2007-06-12 01:41:23 +04:00
evgen@moonbone.local
b90901130e Bug#28505: mysql_affected_rows() may return wrong result if CLIENT_FOUND_ROWS
flag is set.

When the CLIENT_FOUND_ROWS flag is set then the server should return
found number of rows independently whether they were updated or not.
But this wasn't the case for the INSERT statement which always returned
number of rows that were actually changed thus providing wrong info to
the user.

Now the select_insert::send_eof method and the mysql_insert function
are sending the number of touched rows if the CLIENT_FOUND_ROWS flag is set.
2007-06-07 00:30:00 +04:00
aelkin/elkin@dsl-hkibras1-ff5dc300-70.dhcp.inet.fi
3b93001c25 Bug#22725 Replication outages from ER_SERVER_SHUTDOWN (1053) set in replication events
Refining the tests since pb revealed the older version's fragality - the error from SF() due to killed
may be different on different env:s.
DBUG_ASSERT instead of assert.
2007-05-29 16:27:55 +03:00
aelkin/elkin@dsl-hkibras1-ff5dc300-70.dhcp.inet.fi
b8a5a770f0 Bug#22725 Replication outages from ER_SERVER_SHUTDOWN (1053) set in replication events
The reason for the bug was that replaying of a query on slave could not be possible since its event
was recorded with the killed error. Due to the specific of handling INSERT, which per-row-while-loop is 
unbreakable to killing, the query on transactional table should have not appeared in binlog unless
there was  a call to a stored routine that got interrupted with killing (and then there must be an error
returned out of the loop).
   
The offered solution added the following rule for binlogging of INSERT that accounts the above
specifics:
For INSERT on transactional-table if the error was not set the only raised flag
is harmless and is ignored via masking out on time of creation of binlog event.
   
For both table types the combination of raised error and KILLED flag indicates that there
was potentially partial execution on master and consistency is under the question.
In that case the code continues to binlog an event with an appropriate killed error.
 
The fix relies on the specified behaviour of stored routine that must propagate the error 
to the top level query handling if the thd->killed flag was raised in the routine execution.
   
The patch adds an arg with the default killed-status-unset value to Query_log_event::Query_log_event.
2007-05-28 22:20:22 +03:00
kostja@vajra.(none)
bb2a43dd19 Fix a failing assert. 2007-05-16 11:49:15 +04:00
kostja@vajra.(none)
f10effe402 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  vajra.(none):/opt/local/work/mysql-5.0-21483
2007-05-16 09:52:01 +04:00
kostja@vajra.(none)
747842e10b A fix and a test case for
Bug#21483 "Server abort or deadlock on INSERT DELAYED with another
implicit insert"
Also fixes and adds test cases for bugs:
20497 "Trigger with INSERT DELAYED causes Error 1165"
21714 "Wrong NEW.value and server abort on INSERT DELAYED to a
table with a trigger".
Post-review fixes.

Problem:
In MySQL INSERT DELAYED is a way to pipe all inserts into a
given table through a dedicated thread. This is necessary for
simplistic storage engines like MyISAM, which do not have internal
concurrency control or threading and thus can not
achieve efficient INSERT throughput without support from SQL layer.
DELAYED INSERT works as follows:
For every distinct table, which can accept DELAYED inserts and has
pending data to insert, a dedicated thread is created to write data
to disk. All user connection threads that attempt to
delayed-insert into this table interact with the dedicated thread in
producer/consumer fashion: all records to-be inserted are pushed
into a queue of the dedicated thread, which fetches the records and 
writes them.
In this design, client connection threads never open or lock
the delayed insert table.
This functionality was introduced in version 3.23 and does not take 
into account existence of triggers, views, or pre-locking.
E.g. if INSERT DELAYED is called from a stored function, which,
in turn, is called from another stored function that uses the delayed
table, a deadlock can occur, because delayed locking by-passes
pre-locking. Besides:
 * the delayed thread works directly with the subject table through
   the storage engine API and does not invoke triggers
 * even if it was patched to invoke triggers, if triggers,
   in turn, used other tables, the delayed thread would
   have to open and lock involved tables (use pre-locking).
 * even if it was patched to use pre-locking, without deadlock
   detection the delayed thread could easily lock out user 
   connection threads in case when the same table is used both
   in a trigger and on the right side of the insert query: 
   the delayed thread would not release locks until all inserts 
   are complete, and user connection can not complete inserts 
   without having locks on the tables used on the right side of the
   query.

Solution:

These considerations suggest two general alternatives for the
future of INSERT DELAYED:
 * it is considered a full-fledged alternative to normal INSERT
 * it is regarded as an optimisation that is only relevant 
   for simplistic engines.
Since we missed our chance to provide complete support of new
features when 5.0 was in development, the first alternative
currently renders infeasible.
However, even the second alternative, which is to detect
new features and convert DELAYED insert into a normal insert, 
is not easy to implement.
The catch-22 is that we don't know if the subject table has triggers
or is a view before we open it, and we only open it in the
delayed thread. We don't know if the query involves pre-locking
until we have opened all tables, and we always first create
the delayed thread, and only then open the remaining tables.
This patch detects the problematic scenarios and converts
DELAYED INSERT to a normal INSERT using the following approach:
 * if the statement is executed under pre-locking (e.g. from
   within a stored function or trigger) or the right
   side may require pre-locking, we detect the situation
   before creating a delayed insert thread and convert the statement
   to a conventional INSERT.
  * if the subject table is a view or has triggers, we shutdown
   the delayed thread and convert the statement to a conventional
   INSERT.
2007-05-16 09:51:05 +04:00
kostja@vajra.(none)
7ff604eb76 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  vajra.(none):/opt/local/work/mysql-5.0-runtime
2007-05-15 13:56:09 +04:00
kostja@vajra.(none)
162e9b9866 Fix a warning. 2007-05-14 10:56:23 +04:00
dlenev@mockturtle.local
d5dbdd9866 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mockturtle.local:/home/dlenev/src/mysql-5.0-cts-3
2007-05-11 21:55:55 +04:00
dlenev@mockturtle.local
8b93e52e92 Fix for:
Bug #20662 "Infinite loop in CREATE TABLE IF NOT EXISTS ... SELECT
              with locked tables"
  Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers"
  Bug #24738 "CREATE TABLE ... SELECT is not isolated properly"
  Bug #24508 "Inconsistent results of CREATE TABLE ... SELECT when
              temporary table exists"
 
Deadlock occured when one tried to execute CREATE TABLE IF NOT
EXISTS ... SELECT statement under LOCK TABLES which held
read lock on target table.
Attempt to execute the same statement for already existing
target table with triggers caused server crashes.
Also concurrent execution of CREATE TABLE ... SELECT statement
and other statements involving target table suffered from
various races (some of which might've led to deadlocks).
Finally, attempt to execute CREATE TABLE ... SELECT in case
when a temporary table with same name was already present
led to the insertion of data into this temporary table and
creation of empty non-temporary table.
 
All above problems stemmed from the old implementation of CREATE
TABLE ... SELECT in which we created, opened and locked target
table without any special protection in a separate step and not
with the rest of tables used by this statement.
This underminded deadlock-avoidance approach used in server
and created window for races. It also excluded target table
from prelocking causing problems with trigger execution.
  
The patch solves these problems by implementing new approach to
handling of CREATE TABLE ... SELECT for base tables.
We try to open and lock table to be created at the same time as
the rest of tables used by this statement. If such table does not
exist at this moment we create and place in the table cache special
placeholder for it which prevents its creation or any other usage
by other threads.

We still use old approach for creation of temporary tables.

Also note that we decided to postpone introduction of some tests
for concurrent behaviour of CREATE TABLE ... SELECT till 5.1.
The main reason for this is absence in 5.0 ability to set @@debug
variable at runtime, which can be circumvented only by using several
test files with individual .opt files. Since the latter is likely
to slowdown test-suite unnecessary we chose not to push this tests
into 5.0, but run them manually for this version and later push
their optimized version into 5.1
2007-05-11 20:33:13 +04:00
gshchepa/uchum@gleb.loc
848f56b046 Fixed bug #28000.
Bug occurs in INSERT IGNORE ... SELECT ... ON DUPLICATE KEY UPDATE
statements, when SELECT returns duplicated values and UPDATE clause
tries to assign NULL values to NOT NULL fields.
NOTE: By current design MySQL server treats INSERT IGNORE ... ON
DUPLICATE statements as INSERT ... ON DUPLICATE with update of
duplicated records, but MySQL manual lacks this information.
After this fix such behaviour becomes legalized.

The write_record() function was returning error values even within
INSERT IGNORE, because ignore_errors parameter of
the fill_record_n_invoke_before_triggers() function call was
always set to FALSE. FALSE is replaced by info->ignore.
2007-05-11 03:17:05 +05:00