Commit graph

403 commits

Author SHA1 Message Date
kostja@bodhi.local
7bf73ac3e5 Merge bodhi.local:/opt/local/work/mysql-5.0-root
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2006-07-07 22:09:43 +04:00
tomas@poseidon.ndb.mysql.com
98874725e0 Bug #20784 Uninitialized memory in update on table with PK not on first column
- partial backport of code from 5.1, do cot compare_record for engines that do not read all columns during update
2006-07-04 11:43:06 +02:00
dlenev@mysql.com
d4450e6696 Fix for bug#18437 "Wrong values inserted with a before update trigger on
NDB table".

SQL-layer was not marking fields which were used in triggers as such. As
result these fields were not always properly retrieved/stored by handler
layer. So one might got wrong values or lost changes in triggers for NDB,
Federated and possibly InnoDB tables.
This fix solves the problem by marking fields used in triggers
appropriately.

Also this patch contains the following cleanup of ha_ndbcluster code:

We no longer rely on reading LEX::sql_command value in handler in order
to determine if we can enable optimization which allows us to handle REPLACE
statement in more efficient way by doing replaces directly in write_row()
method without reporting error to SQL-layer.
Instead we rely on SQL-layer informing us whether this optimization
applicable by calling handler::extra() method with
HA_EXTRA_WRITE_CAN_REPLACE flag.
As result we no longer apply this optimzation in cases when it should not
be used (e.g. if we have on delete triggers on table) and use in some
additional cases when it is applicable (e.g. for LOAD DATA REPLACE).

Finally this patch includes fix for bug#20728 "REPLACE does not work
correctly for NDB table with PK and unique index".
  
This was yet another problem which was caused by improper field mark-up.
During row replacement fields which weren't explicity used in REPLACE
statement were not marked as fields to be saved (updated) so they have
retained values from old row version. The fix is to mark all table
fields as set for REPLACE statement. Note that in 5.1 we already solve
this problem by notifying handler that it should save values from all
fields only in case when real replacement happens.
2006-07-02 01:51:10 +04:00
svoj@may.pils.ru
2c28b3cbf1 Addition to fix for
BUG#18036 - update of table joined to self reports table as crashed

Set exclude_from_table_unique_test value back to FALSE. It is needed for
further check in multi_update::prepare whether to use record cache.
2006-06-19 17:50:52 +05:00
svoj@may.pils.ru
6a90aede13 Merge may.pils.ru:/home/svoj/devel/mysql/BUG18036/mysql-4.1
into  may.pils.ru:/home/svoj/devel/mysql/BUG18036/mysql-5.0
2006-06-19 16:06:29 +05:00
svoj@may.pils.ru
37cdb0fbf3 BUG#18036 - update of table joined to self reports table as crashed
Certain updates of table joined to self results in unexpected
behavior.

The problem was that record cache was mistakenly enabled for
self-joined table updates. Normally record cache must be disabled
for such updates.

Fixed wrong condition in code that determines whether to use
record cache for self-joined table updates.

Only MyISAM tables were affected.
2006-06-19 14:05:14 +05:00
gkodinov@mysql.com
a21a2b5bcd BUG#18681: View privileges are broken
The check for view security was lacking several points :
1. Check with the right set of permissions : for each table ref that
participates in a view there were the right credentials to use in it's
security_ctx member, but these weren't used for checking the credentials.
This makes hard enforcing the SQL SECURITY DEFINER|INVOKER property
consistently.
2. Because of the above the security checking for views was just ruled out
in explicit ways in several places.
3. The security was checked only for the columns of the tables that are
brought into the query from a view. So if there is no column reference
outside of the view definition it was not detecting the lack of access to
the tables in the view in SQL SECURITY INVOKER mode.

The fix below tries to fix the above 3 points.
2006-05-26 11:47:53 +03:00
evgen@sunlight.local
b9949ed9c7 Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
Mutli-table uses temporary table to store new values for fields. With the
new values the rowid of the record to be updated is stored in a Field_string
field. Table to be updated is set as source table of the rowid field.
But when the temporary table creates the tmp field for the rowid field it
converts it to a varstring field because the table to be updated was created by
the v4.1. Due to this the stored rowids were broken and no records for 
update were found.

The flag can_alter_field_type is added to Field_string class. When it is set to
0 the field won't be converted to varstring. The Field_string::type() function 
now always returns MYSQL_TYPE_STRING if can_alter_field_type is set to 0.
The multi_update::initialize_tables() function now sets can_alter_field_type
flag to 0 for the rowid fields denying conversion of the field to a varstring
field.
2006-04-05 13:29:04 +04:00
monty@mysql.com
54274976e7 Fixed compiler warnings from gcc 4.0.2:
- Added empty constructors and virtual destructors to many classes and structs
- Removed some usage of the offsetof() macro to instead use C++ class pointers
2006-02-25 17:46:30 +02:00
dlenev@mysql.com
e47606a30b Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mysql.com:/home/dlenev/src/mysql-5.0-bg16593
2006-02-16 16:22:53 +03:00
dlenev@mysql.com
4a41a00d4b Fix for bug #16593 "Deadlock or crash in stress test for case where
trigger starts trigger".

In short, the deadlock/crash happened when execution of statement, which used
stored functions or activated triggers, coincided with alteration of the
tables used by these functions or triggers (in highly concurrent environment).

Bug was caused by the incorrect handling of tables from prelocked set in
open_tables() functions in situations when refresh happened. This fix replaces
old smart but not very robust way of handling tables after refresh (which was
closing only old tables), with new one which simply closes all tables opened so
far and restarts open_tables().
Also fixed handling of temporary tables in close_tables_for_reopen().

No test case present since bug manifests itself only in concurrent environment.
2006-02-16 16:19:24 +03:00
konstantin@mysql.com
98091b152a Merge mysql.com:/opt/local/work/mysql-4.1-root
into  mysql.com:/opt/local/work/mysql-5.0-root
2006-02-02 18:17:18 +03:00
sergefp@mysql.com
5c3027833b BUG#15935: post-review fixes: added comment 2006-01-26 00:09:04 +03:00
sergefp@mysql.com
5d0e8d81ee BUG#15935: In mysql_update, don't use full index scan when we could have used quick select scan. 2006-01-25 23:25:23 +03:00
ingo@mysql.com
44ef4989bb Merge mysql.com:/home/mydev/mysql-4.1
into  mysql.com:/home/mydev/mysql-4.1-bug5390
2005-12-27 10:36:19 +01:00
ingo@mysql.com
ef52a59418 Merge mysql.com:/home/mydev/mysql-5.0
into  mysql.com:/home/mydev/mysql-5.0-bug5390
2005-12-27 10:31:00 +01:00
ingo@mysql.com
b0e84cb999 BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 5.0.
Extended the unique table check by a check of lock data.
Merge sub-tables cannot be detected by doing name checks only.
2005-12-20 16:35:05 +01:00
jimw@mysql.com
e18679c7ff Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2005-12-12 10:11:56 -08:00
jimw@mysql.com
f7ff3d653a Fix calls to free_underlaid_joins() in INSERT, DELETE, and UPDATE
handling so that indexes are closed before trying to commit the
transaction. (Bug #15536)
2005-12-08 12:33:33 -08:00
ingo@mysql.com
5aa315e23a BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1.
INSERT ... SELECT with the same table on both sides (hidden
below a MERGE table) does now work by buffering the select result.
The duplicate detection works now after open_and_lock_tables() 
on the locks.
I did not find a test case that failed without the change in
sql_update.cc. I made the change anyway as it should in theory
fix a possible MERGE table problem with multi-table update.
2005-12-07 19:52:26 +01:00
igor@rurik.mysql.com
09e6597015 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-12-02 20:42:36 -08:00
evgen@moonbone.local
00b902b065 Manually merged 2005-12-02 19:42:14 +03:00
evgen@moonbone.local
3f72e7645f Fix bug#15028 Multitable update returns different numbers of matched rows
depending on table order

multi_update::send_data() was counting updates, not updated rows. Thus if one 
record have several updates it will be counted several times in 'rows matched'
but updated only once.

multi_update::send_data() now counts only unique rows.
2005-12-01 23:22:20 +03:00
pem@mysql.com
0411412403 Fixed BUG#13729 Stored procedures: packet error after exception handled
Don't set thd->is_fatal_error in sql_update for duplicate key errors.
2005-11-23 11:56:53 +01:00
igor@rurik.mysql.com
8e8a2d79cc Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-11-04 17:54:47 -08:00
monty@mysql.com
164b469660 Fixed wrong merge
Optimize new pushed code
2005-11-02 14:43:25 +02:00
evgen@moonbone.local
6d3bd1e0ee sql_update.cc:
After merge fix
2005-11-01 20:53:27 +03:00
evgen@moonbone.local
bbe58c7e26 Manually merged 2005-11-01 19:47:53 +03:00
igor@rurik.mysql.com
6a1c8d48f6 Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-10-29 09:41:18 -07:00
sergefp@mysql.com
eb57f520ba Merge 2005-10-28 22:31:41 +04:00
bell@sanja.is.com.ua
b5d2e34572 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-owner7-5.0
2005-10-28 10:12:36 +03:00
igor@rurik.mysql.com
30a7c28603 Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-10-27 21:37:52 -07:00
evgen@moonbone.local
77723c2438 Fix bug#14186 select datefield is null not updated
Date field was declared as not null, thus expression 'datefield is null'
was always false. For SELECT special handling of such cases is used. 
There 'datefield is null' converted to 'datefield eq "0000-00-00"'.

In mysql_update() before creation of select added remove_eq_conds() call.
It makes some optimization of conds and in particular performs conversion
from 'is null' to 'eq'. 
Also remove_eq_conds() makes some evaluation of conds and if it founds that
conds is always false then update statement is not processed further.
All this allows to perform some update statements process faster due to
optimized conds, and not wasting resources if conds known to be false.
2005-10-28 01:24:11 +04:00
bell@sanja.is.com.ua
1b164c7b83 support of view underlying tables and SP functions security check added (BUG#9505) (WL#2787) 2005-10-28 00:18:23 +03:00
jani@ua141d10.elisa.omakaista.fi
cbe21a8eb6 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-tmp
2005-10-27 23:43:20 +03:00
sergefp@mysql.com
56aeee44d3 Fix for BUG#14272: Don't run index scan when we should use quick select.
This could cause failures because there are table handlers (like federated)
that support quick select scanning but do not support index scanning.
2005-10-25 16:34:03 +04:00
monty@mysql.com
3e653fb922 Added more tests for new UPDATE ... ORDER BY ... LIMIT optimization 2005-10-25 02:27:40 +03:00
igor@rurik.mysql.com
a236acce10 Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-10-22 19:35:37 -07:00
sergefp@mysql.com
e7065d355c BUG#121915: Merge 4.1->5.0 2005-10-19 01:52:06 +04:00
sergefp@mysql.com
d6903c4566 Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/psergey/mysql-4.1-bug12915-r2
2005-10-18 14:08:50 +04:00
igor@rurik.mysql.com
c136e9c43b Fixed bug #12762:
allowed set functions aggregated in outer subqueries, allowed nested set functions.
2005-10-15 14:32:37 -07:00
bell@sanja.is.com.ua
6d6e107f12 - set 'updating' in both tables list if we have two of them (because of subquery) (BUG#13236)
- fixed test
2005-10-14 00:02:38 +03:00
lars@mysql.com
57f36732ca Merge mysql.com:/users/lthalmann/bkroot/mysql-4.1
into  mysql.com:/users/lthalmann/bk/mysql-5.0
2005-10-10 17:50:19 +02:00
lars@mysql.com
998380521f BUG#12618: Removing fake locking 2005-10-10 15:10:14 +02:00
sergefp@mysql.com
e9f2f9437a BUG#12915: Added single-table UPDATE/DELTE ... ORDER BY ... LIMIT
optimization: now can use index to find records to update/delete
when there is no WHERE clause.
2005-09-30 15:21:37 +04:00
msvensson@neptunus.(none)
fbf4a5e079 Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0
2005-09-28 11:34:53 +02:00
monty@mysql.com
ea6d5f9ec3 Fixed error found during review of new pushed code 2005-09-25 21:22:23 +03:00
guilhem@mysql.com
388cf622ee Fix fur BUG#13348: "multi-table updates and deletes are not logged if no rows were affected".
Not fixed in 4.1 as not critical. Also I'm correcting error checking of multi-UPDATE/DELETE
when it comes to binlogging, to make it consistent with when we rollback the statement.
2005-09-20 17:41:47 +02:00
dlenev@mysql.com
2a96aa110f Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg12704-2
2005-09-15 03:57:59 +04:00
dlenev@mysql.com
e231ebe5fb Fix for bug #12704 "Server crashes during trigger execution".
This bug occurs when some trigger for table used by DML statement is created
or changed while statement was waiting in lock_tables(). In this situation
prelocking set which we have calculated becames invalid which can easily lead
to errors and even in some cases to crashes.

With proposed patch we no longer silently reopen tables in lock_tables(),
instead caller of lock_tables() becomes responsible for reopening tables and
recalculation of prelocking set.
2005-09-15 03:56:09 +04:00