Commit graph

37758 commits

Author SHA1 Message Date
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
evgen@sunlight.local
ef75db8cba Bug#29908: A user can gain additional access through the ALTER VIEW.
Non-definer of a view was allowed to alter that view. Due to this the alterer
can elevate his access rights to access rights of the view definer and thus
modify data which he wasn't allowed to modify. A view defined with
SQL SECURITY INVOKER can't be used directly for access rights elevation.
But a user can first alter the view SQL code and then alter the view to 
SQL SECURITY DEFINER and thus elevate his access rights. Due to this
altering a view with SQL SECURITY INVOKER is also prohibited.

Now the mysql_create_view function allows ALTER VIEW only to the view
definer or a super user.
2007-09-20 18:05:09 +04:00
gluh@mysql.com/eagle.(none)
4ffcc4f266 result fix 2007-09-20 14:38:41 +05:00
gluh@mysql.com/eagle.(none)
6b81174cde Bug#27747 database metadata doesn't return sufficient column default info
added get_field_default_value() function which obtains default value from the field
(used in store_create_info() & get_schema_column_record() functions)
2007-09-20 13:54:46 +05:00
gluh@eagle.(none)
56c927e696 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-09-19 13:50:38 +05:00
gshchepa@devsrv-b.mysql.com
0aa6e95768 select.test:
Post-fix for bug#27695.
2007-09-15 07:04:32 +02:00
gshchepa@devsrv-b.mysql.com
4bf2408ed4 Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  devsrv-b.mysql.com:/data0/gshchepa/mysql-5.0-opt
2007-09-14 21:15:43 +02:00
gkodinov/kgeorge@magare.gmz
0133bc639c Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B31001-5.0-opt
2007-09-14 19:04:47 +03:00
gkodinov/kgeorge@magare.gmz
a2afc56f61 Bug #31001: ORDER BY DESC in InnoDB not working
The optimizer sets index traversal in reverse order only if there are 
 used key parts that are not compared to a constant.
However using the primary key as an ORDER BY suffix rendered the check
incomplete : going in reverse order must still be used even if 
all the parts of the secondary key are compared to a constant.

Fixed by relaxing the check and set reverse traversal even when all
the secondary index keyparts are compared to a const.
Also account for the case when all the primary keys are compared to a
constant.
2007-09-14 17:43:14 +03:00
sergefp@pylon.mylan
15b7d5e8af Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/psergey/mysql-5.0-bug30324
2007-09-14 15:00:10 +04:00
sergefp@mysql.com
8a3e6201b3 BUG#30324: Grouping queries with COUNT(DISTINCT bit column) return wrong results
- The bug was caused by COUNT(DISTINCT ...) code using Unique object in 
  a way that assumed that BIT(N) column occupies a contiguous space in
  temp_table->record[0] buffer. 
- The fix is to make COUNT(DISTINCT ...) code instruct create_tmp_table to
  create temporary table with column of type BIGINT, not BIT(N).
2007-09-14 14:53:13 +04:00
tomas@whalegate.ndb.mysql.com
7cf77f49d3 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2007-09-14 11:08:55 +02:00
tomas@whalegate.ndb.mysql.com
965124b4a5 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2007-09-14 11:05:38 +02:00
gshchepa@devsrv-b.mysql.com
e6e56ccc01 Merge devsrv-b.mysql.com:/users/gshchepa/mysql-5.0-opt
into  devsrv-b.mysql.com:/data0/gshchepa/mysql-5.0-opt
2007-09-14 10:11:51 +02:00
gshchepa/uchum@gleb.loc
72e36e0aa3 Merge gshchepa@bk-internal.mysql.com:/users/gshchepa/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.0-opt-27695
2007-09-14 13:11:50 +05:00
gshchepa/uchum@gleb.loc
7284a865df Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-09-14 12:16:19 +05:00
joerg@trift2.
1dc3246fe3 Merge trift2.:/MySQL/M50/push-5.0
into  trift2.:/MySQL/M50/tmp-5.0
2007-09-13 23:42:17 +02:00
gshchepa/uchum@gleb.loc
e4eadcfbdd Fixed bug #27695.
Declaring an all space column name in the SELECT FROM DUAL or in a view
leads to misleading warning message:
"Leading spaces are removed from name ' '".

The Item::set_name method has been modified to raise warnings like
"Name ' ' has become ''" in case of the truncation of an all
space identifier to an empty string identifier instead of the
"Leading spaces are removed from name ' '" warning message.
2007-09-13 18:41:50 +05:00
mskold/marty@linux.site
f2159e2d21 Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb
2007-09-13 10:35:11 +02:00
mskold/marty@mysql.com/linux.site
44b6c2edad bug#27494 An invalid subselect crashes mysql server: Added check for missing arguments 2007-09-13 09:47:21 +02:00
gshchepa/uchum@gleb.loc
2e7306d503 Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-09-13 11:48:58 +05:00
gshchepa/uchum@gleb.loc
ff042427cf Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-09-12 23:41:35 +05:00
sergefp@mysql.com
1ff0caf49d Better wording in comments 2007-09-12 18:13:19 +04:00
tomas@whalegate.ndb.mysql.com
df552c310d Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2007-09-12 14:01:51 +02:00
tomas@whalegate.ndb.mysql.com
83eed4d876 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-bj
2007-09-12 13:55:22 +02:00
tomas@whalegate.ndb.mysql.com
461a3dccac BUG#23354 revert 2007-09-12 13:53:32 +02:00
tomas@whalegate.ndb.mysql.com
f1674d1b66 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2007-09-12 07:34:42 +02:00
sergefp@mysql.com
06f12f66e8 Post-merge fixes 2007-09-12 01:52:27 +04:00
sergefp@mysql.com
6f702a4b42 Post-merge fixes 2007-09-11 02:41:42 +04:00
sergefp@pylon.mylan
d276ce3402 Merge mysql.com:/home/psergey/mysql-4.1-bug30385
into  mysql.com:/home/psergey/mysql-5.0-bug30385
2007-09-11 02:24:08 +04:00
sergefp@mysql.com
da04109de2 BUG#30385: Server crash when deleting with ORDER BY and LIMIT
in get_index_for_order(), don't walk over the end of the index key parts
when matching index description and needed ordering.
2007-09-10 16:26:51 +04:00
gshchepa/uchum@gleb.loc
d330a49105 Merge gleb.loc:/home/uchum/work/bk/5.0
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-09-06 22:27:13 +05:00
malff/marcsql@weblab.(none)
f4b671d8bc Fixed whitespace 2007-09-04 16:40:27 -06:00
malff/marcsql@weblab.(none)
3a7bcd72f3 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-rt-merge
2007-09-04 14:38:26 -06:00
thek@adventure.(none)
b1d1204576 Merge adventure.(none):/home/thek/Development/cpp/bug21074/my50-bug21074
into  adventure.(none):/home/thek/Development/cpp/mysql-5.0-runtime
2007-09-03 13:46:10 +02:00
thek@adventure.(none)
a8b9bd9f67 - Fix cross compatibility issues by exchanging pthread_yield with my_sleep(0) 2007-09-03 13:42:32 +02:00
mhansson@dl145s.mysql.com
b1cc84ec1d Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  dl145s.mysql.com:/data0/mhansson/my50-bug30234-push
2007-09-03 12:44:17 +02:00
mhansson/martin@linux-st28.site
df5c9e69f0 Bug #30234: Unexpected behavior using DELETE with AS and USING
DELETE FROM ... USING ... statements with the following type of 
ambiguous aliasing gave unexpected results:
DELETE FROM t1 AS alias USING t1, t2 AS alias WHERE t1.a = alias.a;
This query would leave table t1 intact but delete rows from t2.
Fixed by changing DELETE FROM ... USING syntax so that only alias 
references (as opposed to alias declarations) may be used in FROM.
2007-09-03 11:55:35 +02:00
thek@adventure.(none)
0184f50f27 Merge kpettersson@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  adventure.(none):/home/thek/Development/cpp/mysql-5.0-runtime
2007-09-03 10:59:44 +02:00
thek@adventure.(none)
85d7007848 Merge adventure.(none):/home/thek/Development/cpp/bug21074/my50-bug21074
into  adventure.(none):/home/thek/Development/cpp/mysql-5.0-runtime
2007-09-03 10:54:33 +02:00
thek@adventure.(none)
f5ecb35e6c Bug #21074 Large query_cache freezes mysql server sporadically under heavy load
Invaldating a subset of a sufficiently large query cache can take a long time.
During this time the server is efficiently frozen and no other operation can
be executed. This patch addresses this problem by setting a time limit on
how long time a dictionary access request can take before giving up on the 
attempt. This patch does not work for query cache invalidations issued by
DROP, ALTER or RENAME TABLE operations.
2007-09-03 10:47:24 +02:00
gluh@mysql.com/eagle.(none)
33eaf2cd95 Bug#29408 Cannot find view in columns table if the selection contains a function
Use view db name as thread default database, in order to ensure
that the view is parsed and prepared correctly.
2007-09-03 12:22:56 +05:00
gshchepa/uchum@gleb.loc
df7771de65 Merge gleb.loc:/home/uchum/work/bk/5.0-opt-30126
into  gleb.loc:/home/uchum/work/bk/5.0-opt
2007-08-31 17:05:37 +05:00
gshchepa/uchum@gleb.loc
3e49bbd8e7 Fixed bug #30126.
When dumping database from a 4.x server, the mysqldump client
inserted a delimiter sign inside special commentaries of the form:
  /*!... CREATE DATABASE IF NOT EXISTS ... ;*/
During restoration that dump file was splitten by delimiter signs on
the client side, and the rest of some commentary strings was prepended
to following statements.

The 4x_server_emul test case option has been added for use with the
DBUG_EXECUTE_IF debugging macro. This option affects debug server
builds only to emulate particular behavior of a 4.x server for
the mysqldump client testing. Non-debugging builds are not affected.
2007-08-31 16:59:07 +05:00
malff/marcsql@weblab.(none)
ca2b2585a5 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
2007-08-30 17:23:40 -06: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
malff/marcsql@weblab.(none)
f51c6acc37 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-28779-b
2007-08-30 10:38:20 -06:00
kaa@polly.(none)
33d10a0667 Use double quotes instead of single ones which make the test fail on Windows. This is for bug #30164. 2007-08-30 17:21:43 +04:00
kaa@polly.(none)
2bb849644b Bug #30164: Using client side macro inside server side comments generates broken queries
Problem:
  
In cases when a client-side macro appears inside a server-side comment, the add_line() function in mysql.cc discarded all characters until the next delimiter to remove macro arguments from the query string. This resulted in broken queries being sent to the server when the next delimiter character appeared past the comment's boundaries, because the comment closing sequence ('*/') was discarded.
  
Fix:
  
If a client-side macro appears inside a server-side comment, discard all characters in the comment after the macro (that is, until the end of the comment rather than the next delimiter).
This is a minimal fix to allow only simple cases used by the mysqlbinlog utility. Limitations that are worth documenting:
  
- Nested server-side and/or client-side comments are not supported by mysql.cc
- Using client-side macros in multi-line server-side comments is not supported
- All characters after a client-side macro in a server-side comment will be omitted from the query string (and thus, will not be sent to server).
2007-08-30 12:53:24 +04:00