Commit graph

805 commits

Author SHA1 Message Date
gkodinov@mysql.com
7552d8d9ba Merge mysql.com:/home/kgeorge/mysql/5.0/clean
into  mysql.com:/home/kgeorge/mysql/5.0/B18681
2006-05-26 11:51:30 +03: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
monty@mysql.com
9e9ca8b6eb More DBUG statements
Replaced COND_refresh with COND_global_read_lock becasue of a bug in NTPL threads when using different mutexes as arguments to pthread_cond_wait()
The original code caused a hang in FLUSH TABLES WITH READ LOCK in some circumstances because pthread_cond_broadcast() was not delivered to other threads.
This fixes:
Bug#16986: Deadlock condition with MyISAM tables
Bug#20048: FLUSH TABLES WITH READ LOCK causes a deadlock
2006-05-24 17:21:35 +03:00
aelkin@dl145j.mysql.com
6bdd2bbcc1 Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  dl145j.mysql.com:/tmp/andrei/5.0
2006-05-15 19:57:11 +02:00
aelkin@mysql.com
061ed857eb BUG#14157: utf8 encoding in binlog without set character_set_client: e.g DROP temporary
specific to 5.0 version of the patch is motivated by the fact that a wrapper over 
MYSQLLOG::write can not help in 5.0 where query's charset is embedded into event instance in the constructor.
2006-05-15 18:05:23 +03:00
aelkin@mysql.com
c8a6d6c473 BUG#19188: incorrect temporary table name of DROP query in replication
manual merge to account 5.0 specific names of TABLE class
2006-05-14 20:31:42 +03:00
aelkin@mysql.com
c90ae2d2e5 Merge mysql.com:/usr_rh9/home/elkin.rh9/4.1
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/5.0
2006-05-14 11:35:33 +03:00
aelkin@mysql.com
a0b4c8ed12 Merge mysql.com:/net/nb/home/elkin/MySQL/FIXES/4.1-bug19188_tmp_name
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/4.1
2006-05-12 21:38:41 +03:00
aelkin@mysql.com
9b16a7b91a BUG#19188: incorrect temporary table name of DROP query in replication
A pattern to generate binlog for DROPped temp table in close_temporary_tables
  was buggy: could not deal with a grave-accent-in-name table.

  The fix exploits `append_identifier()' for quoting and duplicating accents.
2006-05-12 21:29:06 +03:00
aelkin@mysql.com
226d978ae8 BUG#14157: utf8 encoding in binlog without set character_set_client e.g DROP temporary
Binlog lacks encoding info about DROPped temporary table.

Idea of the fix is to switch temporary to system_charset_info when a temporary table
is DROPped for binlog. Since that is the server, that automatically, but not the client, who generates the query
the binlog should be updated on the server's encoding for the coming DROP.
The `write_binlog_with_system_charset()' is introduced to replace similar problematic places in the code.
2006-05-09 23:01:31 +03:00
dlenev@mysql.com
b9d49ee894 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mysql.com:/home/dlenev/mysql-5.0-bg12472
2006-05-09 16:48:23 +04:00
dlenev@mysql.com
589daad10f Fix for bugs#12472/#15137 'CREATE TABLE ... SELECT ... which explicitly
or implicitly uses stored function gives "Table not locked" error'

CREATE TABLE ... SELECT ... statement which was explicitly or implicitly
(through view) using stored function gave "Table not locked" error.

The actual bug resides in the current locking scheme of CREATE TABLE SELECT
code, which first opens and locks tables of the SELECT statement itself,
and then, having SELECT tables locked, creates the .FRM, opens the .FRM and
acquires lock on it. This scheme opens a possibility for a deadlock, which
was present and ignored since version 3.23 or earlier. This scheme also
conflicts with the invariant of the prelocking algorithm -- no table can
be open and locked while there are tables locked in prelocked mode.

The patch makes an exception for this invariant when doing CREATE TABLE ...
SELECT, thus extending the possibility of a deadlock to the prelocked mode.
We can't supply a better fix in 5.0.
2006-05-09 16:39:11 +04:00
msvensson@shellback.(none)
e5004d1312 Merge shellback.(none):/home/msvensson/mysql/mysql-5.0
into  shellback.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-04-27 17:35:29 +02:00
aelkin@mysql.com
b56d36dd30 Bug#17263 temporary tables and replication
The fix refines the algorithm of generating DROPs for binlog. 
Temp tables with common pseudo_thread_id are clustered into one query. 
Consequently one replication event per pseudo_thread_id is generated.
2006-04-23 19:59:43 +03:00
aelkin@mysql.com
19f134e40b Bug#17263: incorrect DROP query in temporary tables replication
accounting non-ai32 in tmpkeyval. This changeset is supposed to be specifically for 4.1.
Another changeset is going to push into 5.
2006-04-23 19:42:26 +03:00
aelkin@mysql.com
a4ff312037 Bug#17263 temporary tables and replication
Backporting a changeset made for 5.0. Comments from there:

  The fix refines the algorithm of generating DROPs for binlog.
  Temp tables with common pseudo_thread_id are clustered into one query.
  Consequently one replication event per pseudo_thread_id is generated.
2006-04-23 12:18:57 +03:00
tnurnberg@mysql.com
cd5af2ba70 Bug#18964 "return 0 instead of DBUG_RETURN(0) in sql_base.cc::open_table()"
fixlet corrects return to DBUG_RETURN to restore the balance.
2006-04-20 01:02:33 +02:00
tnurnberg@mysql.com
f08eb57b26 debugging a BK issue 2006-04-20 00:55:30 +02:00
tnurnberg@mysql.com
d42d01b9ea Bug#18964 "return 0 instead of DBUG_RETURN(0) in sql_base.cc::open_table()"
fixlet corrects return to DBUG_RETURN to restore the balance.
2006-04-19 22:56:48 +02:00
timour@mysql.com
593bd1d3b8 Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-bug-15229
2006-03-06 11:41:19 +02:00
timour@mysql.com
103604ed06 Fix for BUG#15229.
The cause of this bug was a design flaw due to which the list of natural
join columns was incorrectly computed and stored for nested joins that
are not natural joins, but are operands (possibly indirect) of nested joins.

The patch corrects the flaw in a such a way, that the result columns of a
table reference are materialized only if it is a leaf table (that is, only
if it is a view, stored table, or natural/using join).
2006-03-02 11:50:15 +02:00
dlenev@mysql.com
6cb5c38c14 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg13525
2006-02-27 20:00:03 +03: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
monty@mysql.com
82b77cdd90 Fixes to embedded server to be able to run tests with it
(Needed for "list of pushes" web page and autopush)
2006-02-24 18:34:15 +02:00
konstantin@mysql.com
630869bc56 Cleanup. 2006-02-23 16:21:43 +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
svoj@april.(none)
7c76ae4c13 BUG#16893: Crash in test 'fulltext_order_by'
Fixed that fulltext query + union results in unexpected behaviour.
2006-02-03 14:09:33 +04:00
evgen@moonbone.local
6e984d6ede sql_base.cc:
Small fix after merge of fix for bug#16510
2006-01-25 23:28:39 +03:00
evgen@moonbone.local
baed6da5bc Manually merged 2006-01-24 22:10:39 +03:00
evgen@moonbone.local
b1967ad723 Fixed bug #16510: Updating field named like '*name' caused server crash.
When setup_fields() function finds field named '*' it expands it to the list
of all table fields. It does so by checking that the first char of
field_name is '*', but it doesn't checks that the '* is the only char.
Due to this, when updating table with a field named like '*name', such field
is wrongly treated as '*' and expanded. This leads to making list of fields
to update being longer than list of the new values. Later, the fill_record() 
function crashes by dereferencing null when there is left fields to update,
but no more values.

Added check in the setup_fields() function which ensures that the field
expanding will be done only when '*' is the only char in the field name.
2006-01-23 21:51:32 +03:00
jani@ua141d10.elisa.omakaista.fi
617585eb33 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
2006-01-12 20:28:23 +02:00
monty@mysql.com
2970e71ce8 Re-run fix-fields on condition if table was reopened in HANDLERREAD 2006-01-10 19:13:12 +02:00
monty@mysql.com
b0a5ea01ef Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2006-01-06 01:08:48 +02:00
monty@mysql.com
6e22e29de6 Review fixes of new pushed code
- Fixed tests
- Optimized new code
- Fixed some unlikely core dumps
- Better bug fixes for:
  - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
  - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null
2006-01-06 00:47:49 +02:00
konstantin@mysql.com
4a4b8eacc1 Post-merge fixes. 2006-01-04 21:39:39 +03:00
konstantin@mysql.com
6502e6bba7 Merge mysql.com:/opt/local/work/mysql-4.1-7209-new
into  mysql.com:/opt/local/work/mysql-5.0-merge
2006-01-04 17:49:45 +03:00
konstantin@mysql.com
f7d6fa6f17 A fix for Bug#7209 "Client error with "Access Denied" on updates
when high concurrency": remove HASH::current_record and make it
an external search parameter, so that it can not be the cause of a 
race condition under high concurrent load.
The bug was in a race condition in table_hash_search,
when column_priv_hash.current_record was overwritten simultaneously
by multiple threads, causing the search for a suitable grant record
to fail.
No test case as the bug is repeatable only under concurrent load.
2006-01-04 17:35:30 +03: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
igor@rurik.mysql.com
ad53d72033 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-12-10 23:31:03 -08:00
dlenev@mysql.com
40614adf66 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2
2005-12-07 12:47:25 +03:00
dlenev@mysql.com
06b895c096 Fix for bug #11555 "Stored procedures: current SP tables locking make
impossible view security".

We should not expose names of tables which are explicitly or implicitly (via
routine or trigger) used by view even if we find that they are missing.
So during building of list of prelocked tables for statement we track which
routines (and therefore tables for these routines) are used from views. We
mark elements of LEX::routines set which correspond to routines used in views
by setting Sroutine_hash_entry::belong_to_view member to point to TABLE_LIST
object for topmost view which uses routine. We propagate this mark to all
routines which are used by this routine and which we add to this set. We also
mark tables used by such routine which we add to the list of tables for
prelocking as belonging to this view.
2005-12-07 12:27:17 +03:00
timour@mysql.com
6d6b617a2e Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-2486
2005-12-06 18:04:26 +02:00
pem@mysql.com
a0ed1d5aba Merge mysql.com:/usr/local/bk/mysql-5.0
into  mysql.com:/usr/home/pem/bug14233/mysql-5.0
2005-12-06 13:34:18 +01:00
timour@mysql.com
687b66b8da WL#2486 - natural/using joins according to SQL:2003
Post-review fixes that simplify the way access rights
are checked during name resolution and factor out all
entry points to check access rights into one single
function.
2005-11-30 21:27:11 +02:00
timour@mysql.com
cc7d1268c4 WL#2486 - Natural/using join according to SQL:2003.
Post-review fixes according to Monty's review.
2005-11-28 21:57:50 +02:00
pem@mysql.com
eb5bf2ec33 Fixed BUG#14233: Crash after tampering with the mysql.proc table
Post-review version. Some minor review fixes, but also changed the way
  some errors are handled: Don't return specific parse errors; instead
  always use the more general "table corrupt" error (amended accordingly).
2005-11-25 17:09:26 +01:00
igor@rurik.mysql.com
9b9f8cab4c Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-11-23 21:44:21 -08:00
monty@mysql.com
f5804869e3 Don't use PATH_MAX for FN_REFLEN as this uses too much stack space
Larger stack size neaded for open table on x86 64 bit
Fix failing test cases
Deleted symlink from bk
2005-11-24 02:36:28 +02:00
igor@rurik.mysql.com
7b1b69a6e7 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-11-22 23:00:57 -08:00