Commit graph

276 commits

Author SHA1 Message Date
kroki@mysql.com
08f192f81b Bug#17203: "sql_no_cache sql_cache" in views created from prepared statement
The problem was that we restored SQL_CACHE, SQL_NO_CACHE flags in SELECT
statement from internal structures based on value set later at runtime, not
the original value set by the user.

The solution is to remember that original value.
2006-06-27 21:28:32 +04:00
igor@rurik.mysql.com
d350bd9050 Post-merge fixes 2006-05-31 22:55:45 -07:00
igor@rurik.mysql.com
a6aaca7d6a Post-review fixes for bug #19089 2006-05-22 07:57:46 -07:00
igor@rurik.mysql.com
4a27cbfd02 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2006-05-20 19:10:43 -07:00
igor@rurik.mysql.com
12e53358f0 Fixed bug #19089.
When a CREATE TABLE command created a table from a materialized
view id does not inherit default values from the underlying table.
Moreover the temporary table used for the view materialization
does not inherit those default values.
In the case when the underlying table contained ENUM fields it caused
misleading error messages. In other cases the created table contained
wrong default values.
The code was modified to ensure inheritance of default values for
materialized views.
2006-05-20 18:54:43 -07:00
igor@rurik.mysql.com
3b3e6ecb95 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2006-05-18 11:30:42 -07:00
evgen@moonbone.local
1d820585ae Fixed bug#19077: A nested materialized derived table is used before being populated.
The convert_constant_item() function converts constant items to ints on
prepare phase to optimize execution speed. In this case it tries to evaluate
subselect which contains a derived table and is contained in a derived table. 
All derived tables are filled only after all derived tables are prepared.
So evaluation of subselect with derived table at the prepare phase will
return a wrong result.

A new flag with_subselect is added to the Item class. It indicates that
expression which this item represents is a subselect or contains a subselect.
It is set to 0 by default. It is set to 1 in the Item_subselect constructor
for subselects.
For Item_func and Item_cond derived classes it is set after fixing any argument
in Item_func::fix_fields() and Item_cond::fix_fields accordingly.
The convert_constant_item() function now doesn't convert a constant item
if the with_subselect flag set in it.
2006-05-18 00:55:28 +04:00
igor@rurik.mysql.com
767d25dabd Fixed bug #19573.
The select statement that specified a view could be
slightly changed when the view was saved in a frm file.
In particular references to an alias name in the HAVING
clause could be substituted for the expression named by
this alias.
This could result in an error message for a query of
the form SELECT * FROM <view>. Yet no such message
appeared when executing the query specifying the view.
2006-05-16 22:19:44 -07:00
igor@rurik.mysql.com
90f227043b Fixed bug #19490. The bug that caused server crash manifested
itself when executing queries referring to a view with GROUP BY
an expression containing non-constant interval.
It happened because Item_date_add_interval::eq neglected the
fact that the method can be applied to an expression of the form
    date(col) + interval time_to_sec(col) second
at the time when col could not be evaluated yet.
An attempt to evaluate time_to_sec(col) in this method resulted
in a crash.
2006-05-12 18:24:38 -07:00
gkodinov@mysql.com
0486cfbee2 BUG#7549: Missing error message for invalid view selection with subquery.
When a view statement is compiled on CREATE VIEW time, most of the 
optimizations should not be done. Finding the right optimization 
for a subquery is one of them.
Unfortunately the optimizer is resolving the column references of 
the left expression of IN subqueries in the process of deciding 
witch optimization to use (if needed). So there should be a 
special case in Item_in_subselect::fix_fields() : check the 
validity of the left expression of IN subqueries in CREATE VIEW 
mode and then proceed as normal.
2006-05-11 15:30:54 +03:00
bell@sanja.is.com.ua
0e331dfb92 fixed error message text 2006-04-26 17:57:41 +03:00
dlenev@mysql.com
c77d5a0ed1 Fix for bug#15153 "CONVERT_TZ() is not allowed in all places in VIEWs".
Error was emitted when one tried to select information from view which used
merge algorithm and which also had CONVERT_TZ() function in its select list.

This bug was caused by wrong assumption that global table list for view
which is handled using merge algorithm begins from tables belonging to
the main select of this view. Nowadays the above assumption is not true only
when one uses convert_tz() function in view's select list, but in future
other cases may be added (for example we may support merging of views
with subqueries in select list one day). Relying on this false assumption
led to the usage of wrong table list for field lookups and therefor errors. 

With this fix we explicitly use pointer to the beginning of main select's
table list.
2006-04-22 11:54:25 +04:00
bell@sanja.is.com.ua
efb8b990e4 The check for recursive view definitions added. (BUG#14308) 2006-04-13 23:12:26 +03:00
igor@rurik.mysql.com
17141582d4 Fixed bug #16069.
The function agg_cmp_type in item_cmpfunc.cc neglected the fact that 
the first argument in a BETWEEN/IN predicate could be a field of a view.
As a result in the case when the retrieved table was hidden by a view 
over it and the arguments in the BETWEEN/IN predicates are of 
the date/time type the function did not perform conversion of 
the constant arguments to the same format as the first field argument.
If formats of the arguments differed it caused wrong a evaluation of
the predicates.
2006-04-08 11:42:09 -07:00
igor@rurik.mysql.com
f485125968 Fixed bug #18237.
The code in opt_sum_query that prevented the COUNT/MIN/MAX 
optimization from being applied to outer joins  was not adjusted 
after introducing nested joins. As a result if an outer join
contained a reference to a view as an inner table the code of
opt_sum_query missed the presence of an on expressions and
erroneously applied the mentioned optimization.
2006-04-04 12:55:02 -07:00
igor@rurik.mysql.com
f57e0b3db7 Fixed bug #18386.
An invalid assertion in Item_direct_view_ref::eq caused 
an assertion abort in the debug version.
2006-03-27 18:28:55 -08:00
evgen@moonbone.local
62a266f114 Fixed bug#17726: Not checked empty list caused endless loop
When the Item_cond::fix_fields() function reduces cond tree, it in loop
scans it's own list and when it founds Item_cond with same function (AND
or OR) it does next things: 1) replaces that item with item's list. 2)
empties item's list. Due to this operation is done twice - for update and
for view, at the update phase cond's list of lower view is already empty.
Empty list returns ref to itself, thus making endless loop by replacing
list with itself, emptying, replacing again and so on. This results in
server hung up.

To the Item_cond::fix_fields() function added check that ensures that
list being replaced with isn't empty.
2006-03-03 16:19:57 +03:00
SergeyV@selena.
763475754a Merge svlasenko@bk-internal.mysql.com:/home/bk/mysql-5.0
into  selena.:H:/MYSQL/src/#15943-mysql-5.0
2006-02-27 20:00:03 +03: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
SergeyV@selena.
da94b1662b Fixes bug #15943. resets error flag for show create view command, to allow
proper processing of multiple sql statements sent as a single command.
2006-02-13 19:53:34 +03:00
igor@rurik.mysql.com
86606615ab Fixed bug #16382.
When an ambiguous field name is used in a group by clause a warning is issued
in the find_order_in_list function by a call to push_warning_printf.
An expression that was not always valid was passed to this call as the field
name parameter.
2006-02-01 20:43:43 -08:00
msvensson@neptunus.(none)
3d5f530caa Merge neptunus.(none):/home/msvensson/mysql/mysqltest_var/my50-mysqltest_var
into  neptunus.(none):/home/msvensson/mysql/mysqltest_var/my50-mysqltest_var-integration
2006-01-24 08:43:34 +01:00
msvensson@neptunus.(none)
09ec2919a1 Make it possible to run mysql-test-run.pl with default test suite in different vardir. 2006-01-24 08:30:54 +01:00
igor@rurik.mysql.com
d2cfad167b Fixed bug #16016: MIN/MAX optimization was not applied to views. 2006-01-06 22:28:26 -08: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
gluh@eagle.intranet.mysql.r18.ru
f4b052844f Fix for bug#14861 aliased column names are not preserved.
Create tmp table filed using original item name when it's necessary
2005-12-19 15:36:03 +04:00
dlenev@mysql.com
b5e21b60d9 Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2
2005-12-07 14:38:20 +03: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
serg@serg.mylan
6b5320d617 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
2005-12-05 18:18:56 +01:00
serg@serg.mylan
719089a819 better error for optimize/repair/etc a view 2005-12-05 12:08:30 +01:00
bell@sanja.is.com.ua
b1f0e78146 Merge sanja.is.com.ua:/home/bell/mysql/bk/work-bug1-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-merge1-5.0
2005-12-02 21:20:25 +02:00
bell@sanja.is.com.ua
45e59f3d76 Now we shall store only position (index of first character)
of SELECT from query begining, to be independet of query buffer
allocation.
Correct procedure used to find beginning of the current statement
during parsing (BUG#14885).
2005-12-02 21:18:12 +02:00
bell@sanja.is.com.ua
2ff98e0586 View creation code fixed to expect empty TABLE_LIST::table pointer (BUG#15096). 2005-12-01 12:15:48 +02:00
evgen@moonbone.local
badc2668ce Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into moonbone.local:/work/13622-bug-5.0-mysql
2005-11-18 17:26:44 +03:00
timour@mysql.com
9a644b948c WL#2486 - natural/using joins according to SQL:2003.
Enabled view tests that didn't work before.
2005-11-18 10:51:46 +02:00
evgen@moonbone.local
a031778955 Manually merged 2005-11-18 01:16:15 +03:00
evgen@moonbone.local
7749b8d15b Merge 2005-11-16 02:08:20 +03:00
evgen@moonbone.local
35f7b50b18 Fix bug #14816 test_if_order_by_key() expected only Item_fields.
test_if_order_by_key() expected only Item_fields to be in order->item, thus
failing to find available index on view's field, which results in reported
error.

Now test_if_order_by_key() calls order->item->real_item() to get field for
choosing index.
2005-11-14 22:10:34 +03:00
evgen@moonbone.local
70e1974f76 Fix bug #14850 Item_ref's null_value wasn't updated
Item_ref's null_value wasn't updated in save_org_in_field() causing reported
error.
2005-11-14 21:52:39 +03:00
evgen@moonbone.local
508824f7c4 Fix bug #13622 Wrong view .frm created if some field's alias contain \n
View .frm parser assumes that query string will take only 1 line, with \n in
aliases query stringmay take several lines thus produces bad .frm file.

'query' parameter type changed from 'string' to 'escaped string'
2005-11-11 20:03:32 +03:00
anozdrin@mysql.com
491e4f89f5 WL#2818 (Add creator to the trigger definition for privilege
checks on trigger activation)
2005-11-10 22:25:03 +03:00
pem@mysql.com
b01e7393bf Fixed BUG#14719: Views DEFINER grammar is incorrect
Corrected the syntax for the current_user() case.
  (It's "definer = current_user[()]", not just "current_user[()]".)
2005-11-09 16:51:00 +01:00
igor@rurik.mysql.com
60a4b4fb16 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2005-11-05 22:45:54 -08:00
igor@rurik.mysql.com
0960f5fedc Post review fixes. 2005-11-05 22:41:36 -08:00
sergefp@mysql.com
a88ecb9a3d Post-merge fixes 2005-11-03 12:38:46 +03:00
sergefp@mysql.com
8fefb36800 Merged 2005-11-03 10:28:12 +03:00
igor@rurik.mysql.com
f878cc589d Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2005-11-02 22:24:36 -08:00
igor@rurik.mysql.com
44dd303c47 Post review fixes. 2005-11-02 22:13:10 -08:00