Commit graph

1091 commits

Author SHA1 Message Date
Kristofer.Pettersson@naruto.
fe43de3929 Merge naruto.:C:/cpp/bug20777/my50-bug20777
into  naruto.:C:/cpp/mysql-5.0-runtime
2007-03-23 19:14:13 +01:00
Kristofer.Pettersson@naruto.
fba7393b3e Merge kpettersson@bk-internal:/home/bk/mysql-5.1-runtime
into  naruto.:C:/cpp/mysql-5.1-runtime
2007-03-23 18:13:21 +01:00
Kristofer.Pettersson@naruto.
6e4b7ba1fb Merge naruto.:C:/cpp/bug20777/my51-bug20777
into  naruto.:C:/cpp/mysql-5.1-runtime
2007-03-20 17:23:28 +01:00
kostja@bodhi.local
bdb10baec1 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime
2007-03-20 00:42:11 +03:00
kostja@bodhi.local
a9065201d5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-03-19 23:59:53 +03:00
Kristofer.Pettersson@naruto.
13af4d5417 Manual merge 2007-03-19 16:45:09 +01:00
Kristofer.Pettersson@naruto.
ab23aa253d Merge naruto.:C:/cpp/bug20777/my50-bug20777
into  naruto.:C:/cpp/bug20777/my51-bug20777
2007-03-16 18:17:27 +01:00
Kristofer.Pettersson@naruto.
05bef7884a Bug#20777 Function w BIGINT UNSIGNED shows diff. behaviour with and without --ps-protocol
- Stored procedures returning unsinged values returns signed values if
  text protocol is used. The reason is that the stored proceedure item
  Item_func_sp wasn't initializing the member variables properly based
  on the information contained in the associated result field.
- The patch is to upon field-item association, ::fix_fields, initialize
  the member variables in appropriate order.
- Field type of an Item_func_sp was hard coded to MYSQL_TYPE_VARCHAR.
  This is changed to return the type of the actual result field.
- Member function name sp_result_field was refactored to the more 
  appropriate init_result_field.
- Member function name find_and_check_access was refactored to 
  sp_check_access.
2007-03-16 14:25:11 +01:00
malff/marcsql@weblab.(none)
62247621b0 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-26503-merge
2007-03-14 15:36:11 -06:00
anozdrin/alik@booka.opbmk
c666e2f276 Polishing: use constants instead of magic numbers. 2007-03-09 08:05:08 +03:00
holyfoot/hf@hfmain.(none)
cdcf3ec097 Merge bk@192.168.21.1:mysql-5.1
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt
2007-03-08 22:04:17 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
11dd0fa326 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt
2007-03-08 21:42:41 +04:00
holyfoot/hf@hfmain.(none)
75be7cd1ae Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt
2007-03-08 19:08:28 +04:00
evgen@moonbone.local
b81b814cd1 Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
result.

For built-in functions like sqrt() function names are hard-coded and can be
compared by pointer. But this isn't the case for a used-defined stored
functions - names there are dynamical and should be compared as strings.

Now the Item_func::eq() function employs my_strcasecmp() function to compare
used-defined stored functions names.
2007-03-07 22:11:57 +03:00
kostja@bodhi.local
3d488d496d Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2007-03-06 16:44:14 +03:00
antony@ppcg5.local
dc24473cb2 WL#2936
"Server Variables for Plugins"
  Implement support for plugins to declare server variables.
  Demonstrate functionality by removing InnoDB specific code from sql/*
  New feature for HASH - HASH_UNIQUE flag
  New feature for DYNAMIC_ARRAY - initializer accepts preallocated ptr.
  Completed support for plugin reference counting.
2007-03-02 08:43:45 -08:00
malff/marcsql@weblab.(none)
2b1a04e7b9 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-26093
2007-03-01 20:08:58 -07:00
malff/marcsql@weblab.(none)
6cf49ef065 Manual merge 2007-03-01 20:04:49 -07:00
malff/marcsql@weblab.(none)
ad45f0168d Bug#26093 (SELECT BENCHMARK() for SELECT statements does not produce valid
results)

Before this fix, the function BENCHMARK() would fail to evaluate expressions
like "(select avg(a) from t1)" in debug builds (with an assert),
or would report a time of zero in non debug builds.

The root cause is that evaluation of DECIMAL_RESULT expressions was not
supported in Item_func_benchmark::val_int().

This has been fixed by this change.
2007-03-01 19:20:47 -07:00
lars/lthalmann@dl145k.mysql.com
4265501c9f Merge mysql.com:/nfsdisk1/lars/MERGE/mysql-5.0-merge
into  mysql.com:/nfsdisk1/lars/MERGE/mysql-5.1-merge
2007-02-27 19:20:47 +01:00
cbell/Chuck@mysql_cab_desk.
995f2ae13f Merge cbell@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into  mysql_cab_desk.:C:/source/C++/mysql-5.1-new-rpl
2007-02-26 14:33:58 -05:00
cbell/Chuck@mysql_cab_desk.
e9481608c3 Merge cbell@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  mysql_cab_desk.:C:/source/c++/mysql-5.0-rpl
2007-02-26 14:30:44 -05:00
cbell/Chuck@mysql_cab_desk.
d7e4de9937 BUG#20141 "User-defined variables are not replicated properly for
SF/Triggers in SBR mode."
BUG#14914 "SP: Uses of session variables in routines are not always replicated"
BUG#25167 "Dupl. usage of user-variables in trigger/function is not replicated
          correctly"

User-defined variables used inside of stored functions/triggers in
statements which did not update tables directly were not replicated.
We also had problems with replication of user-defined variables which
were used in triggers (or stored functions called from table-updating
statements) more than once.

This patch addresses the first issue by enabling logging of all
references to user-defined variables in triggers/stored functions
and not only references from table-updating statements.

The second issue stemmed from the fact that for user-defined
variables used from triggers or stored functions called from
table-updating statements we were writing binlog events for each
reference instead of only one event for the first reference.
This problem is already solved for stored functions called from
non-updating statements with help of "event unioning" mechanism.
So the patch simply extends this mechanism to the case affected.
It also fixes small problem in this mechanism which caused wrong
logging of references to user-variables in cases when non-updating
statement called several stored functions which used the same
variable and some of these function calls were omitted from binlog
as they were not updating any tables.
2007-02-26 14:06:10 -05:00
cbell/Chuck@mysql_cab_desk.
4c6ced9fc5 BUG#20141 "User-defined variables are not replicated properly for SF/
Triggers in SBR mode."
BUG#14914 "SP: Uses of session variables in routines are not always
           replicated"
BUG#25167 "Dupl. usage of user-variables in trigger/function is not
           replicated correctly"

User-defined variables used inside of stored functions/triggers in
statements which did not update tables directly were not replicated.
We also had problems with replication of user-defined variables which
were used in triggers (or stored functions called from table-updating
statements) more than once.

This patch addresses the first issue by enabling logging of all
references to user-defined variables in triggers/stored functions
and not only references from table-updating statements.

The second issue stemmed from the fact that for user-defined
variables used from triggers or stored functions called from
table-updating statements we were writing binlog events for each
reference instead of only one event for the first reference.
This problem is already solved for stored functions called from
non-updating statements with help of "event unioning" mechanism.
So the patch simply extends this mechanism to the case affected.
It also fixes small problem in this mechanism which caused wrong
logging of references to user-variables in cases when non-updating
statement called several stored functions which used the same
variable and some of these function calls were omitted from binlog
as they were not updating any tables.
2007-02-23 12:58:56 -05:00
monty@mysql.com/narttu.mysql.fi
f0ae3ce9b9 Fixed compiler warnings
Fixed compile-pentium64 scripts
Fixed wrong estimate of update_with_key_prefix in sql-bench
Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1
Fixed unsafe define of uint4korr()
Fixed that --extern works with mysql-test-run.pl
Small trivial cleanups
This also fixes a bug in counting number of rows that are updated when we have many simultanous queries
Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc
Split handle_one_connection() into reusable sub functions.
Split create_new_thread() into reusable sub functions.
Added thread_scheduler; Preliminary interface code for future thread_handling code.

Use 'my_thread_id' for internal thread id's
Make thr_alarm_kill() to depend on thread_id instead of thread
Make thr_abort_locks_for_thread() depend on thread_id instead of thread
In store_globals(), set my_thread_var->id to be thd->thread_id.
Use my_thread_var->id as basis for my_thread_name()
The above changes makes the connection we have between THD and threads more soft.

Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions
Fixed compiler warnings
Fixed core dumps when running with --debug
Removed setting of signal masks (was never used)
Made event code call pthread_exit() (portability fix)
Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called.
Made handling of thread_id and thd->variables.pseudo_thread_id uniform.
Removed one common 'not freed memory' warning from mysqltest
Fixed a couple of usage of not initialized warnings (unlikely cases)
Suppress compiler warnings from bdb and (for the moment) warnings from ndb
2007-02-23 13:13:55 +02:00
monty@mysql.com/narttu.mysql.fi
26aa385bc5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-02-21 14:07:08 +02:00
mskold/marty@linux.site
6e418074b6 Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb
2007-02-09 16:40:36 +01:00
mskold/marty@linux.site
d6bb9d21bf Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.0
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1
2007-02-09 16:33:52 +01:00
mskold/marty@mysql.com/linux.site
6ac9a28ef0 bug #26225 Engine condition pushdown doesn't work with prepare statements (ps_7ndb): ensure that query plan for prepared statement is analyzed correctly 2007-02-09 16:31:12 +01:00
gluh@mysql.com/eagle.(none)
da9f2149de Merge mysql.com:/home/gluh/MySQL/Merge/4.1
into  mysql.com:/home/gluh/MySQL/Merge/4.1-opt
2007-02-08 14:54:49 +04:00
jani@a88-113-38-195.elisa-laajakaista.fi
cd75806b61 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1
2007-02-03 00:58:09 +02:00
holyfoot/hf@mysql.com/hfmain.(none)
6391613d32 bug #25895 (compiling the embedded server fails on some 64-bit platforms)
it can't be compile everywhere if we just cast pointer to pthread_t
So now we use correct pthread_self() value as the pthread_t and
pointer where we need to identify the thread exactly.
2007-01-29 17:39:28 +04:00
monty@narttu.mysql.fi
bb464613ce Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-01-29 01:57:07 +02:00
monty@mysql.com/narttu.mysql.fi
410fc81a72 After merge fixes
Removed a lot of compiler warnings
Removed not used variables, functions and labels
Initialize some variables that could be used unitialized (fatal bugs)
%ll -> %l
2007-01-29 01:47:35 +02:00
monty@narttu.mysql.fi
8a80e36ac3 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
Merge of 'remove compiler warnings when using -Wshadow'
2007-01-27 03:46:45 +02:00
gluh@mysql.com/eagle.(none)
658777d808 Merge mysql.com:/home/gluh/MySQL/Merge/4.1-opt
into  mysql.com:/home/gluh/MySQL/Merge/4.1
2007-01-26 16:28:32 +04:00
igor@olga.mysql.com
36df33d80a Fixed bug #24653.
The bug report has demonstrated the following two problems.
1. If an ORDER/GROUP BY list includes a constant expression being 
optimized away and, at the same time, containing single-row
subselects that return more that one row, no error is reported.
Strictly speaking the standard allows to ignore error in this case.
Yet, now a corresponding fatal error is reported in this case.
2. If a query requires sorting by expressions containing single-row
subselects that, however, return more than one row, then the execution
of the query may cause a server crash. 
To fix this some code has been added that blocks execution of a subselect
item in case of a fatal error in the method Item_subselect::exec.
2007-01-25 18:44:35 -08:00
gluh@eagle.(none)
7b291e36cf Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-01-24 19:54:40 +04:00
gkodinov/kgeorge@macbook.gmz
7fd3cd9e41 Merge bk-internal:/home/bk/mysql-5.1-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt
2007-01-24 15:57:58 +02:00
gkodinov/kgeorge@macbook.gmz
450e9b6b30 Bug #6172: RAND(a) should only accept constant values as arguments
RAND() must accept scalar expressions regardless of their kind.
 That includes both constant expressions and expressions that 
 depend on column values.
 When the expression is constant the random seed can be initialized
 at compile time.
 However when the expression is not constant the random seed must be
 initialized at each invocation (while it still can be allocated at
 compile time).
 Implemented the above rules by extending Item_func_rand::val_real()
 to initialize the random seed at the correct place.
2007-01-23 19:45:58 +02:00
gkodinov/kgeorge@macbook.gmz
17a0207ece Merge macbook.gmz:/Users/kgeorge/mysql/work/mysql-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt
2007-01-23 12:34:50 +02:00
gluh@mysql.com/eagle.(none)
e34b0056f2 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-01-23 14:08:58 +04:00
igor@olga.mysql.com
9659c11b6e Fixed bug #25637: LEFT JOIN with BOOLEAN FULLTEXT loses left table matches.
The bug is actually a duplicate of the bug 14708.
Down-ported the fix for 14708 from 5.0.  
Merged the test case for bug 14708 from 5.0.
2007-01-22 14:23:53 -08:00
monty@mysql.com/narttu.mysql.fi
a04157fbb3 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-01-22 14:04:40 +02:00
gkodinov/kgeorge@macbook.gmz
20d94f1105 Bug #25382: Passing NULL to an UDF called from stored procedures
crashes server
 Check for null value is reliable only after calling some of the 
 val_xxx() methods. If the val_xxx() method is not called
 the null_value flag will be set only for certain types of NULL
 values (like SQL constant NULLs for example).
 This caused a crash while trying to dereference a NULL pointer
 that is returned by val_str() for NULL values.
 Fixed by swapping the order of val_xxx() and null_value check.
2007-01-18 17:33:38 +02:00
kostja@bodhi.local
16d53afcd2 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime
2007-01-12 22:06:46 +03:00
kostja@bodhi.local
5a99ffdf92 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-01-12 21:59:17 +03:00
kostja@bodhi.local
b72c2771dc Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime
2007-01-11 22:15:20 +03:00
kostja@bodhi.local
bf1005a125 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-01-11 21:59:28 +03:00
kostja@bodhi.local
dd03d51f22 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  bodhi.local:/opt/local/work/mysql-4.1-runtime
2007-01-11 21:49:52 +03:00
gluh@eagle.(none)
42e49682b7 Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-01-10 14:14:22 +04:00
evgen@moonbone.local
e098f736e1 Fixed bug#16861: User defined variable can have a wrong value if a tmp table was
used.

The Item::save_in_field() function is called from fill_record() to fill the 
new row with data while execution of the CREATE TABLE ... SELECT statement.
Item::save_in_field() calls val_xxx() methods in order to get values.
val_xxx() methods do not take into account the result field. Due to this
Item_func_set_user_var::val_xxx() methods returns values from the original
table, not from the temporary one.

The save_in_field() member function is added to the Item_func_set_user_var
class. It detects whether the result field should be used and properly updates
the value of the user variable.
2007-01-09 23:24:56 +03:00
kroki/tomash@moonlight.home
7bf893f551 Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-5.0-bug23443
into  moonlight.home:/home/tomash/src/mysql_ab/mysql-5.1-bug23443
2007-01-09 12:44:16 +03:00
kroki/tomash@moonlight.home
1eb5b28fb7 Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-4.1-bug23443
into  moonlight.home:/home/tomash/src/mysql_ab/mysql-5.0-bug23443
2007-01-09 12:40:34 +03:00
kroki/tomash@moonlight.home
45e9762027 Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-4.0-bug23443
into  moonlight.home:/home/tomash/src/mysql_ab/mysql-4.1-bug23443
2007-01-09 12:39:05 +03:00
kroki/tomash@moonlight.home
5b4d9d8706 BUG#23443: user-defined variables can consume too much memory in the
server

The problem was that when memory was exhausted HEAP engine could crash
(GROUP BY uses HEAP TABLE).  Alternatively, if SET was used, it could
report an error "You may only use constant expressions with SET" instead
of "Out of memory (Needed NNNNNN bytes)".

The solution is:
 - pass MY_WME to (some) calls to my_malloc() to get correct message.
 - fix heap_write() so that the first key is skipped during cleanup
   on ENOMEM because it wasn't inserted and doesn't have to be
   deleted.

No test case is provided because we can't test out-of-memory behaviour
in our current test framework.
2007-01-09 12:24:25 +03:00
holyfoot/hf@hfmain.(none)
b4c0867df1 Merge mysql.com:/d2/hf/clean/my51-clean
into  mysql.com:/d2/hf/common/my51-common
2006-12-31 12:41:42 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
874d366500 Merge mysql.com:/d2/hf/clean/my50-clean
into  mysql.com:/d2/hf/common/my50-common
2006-12-31 12:39:20 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
0831699f5c Merge mysql.com:/d2/hf/clean/my41-clean
into  mysql.com:/d2/hf/common/my41-common
2006-12-31 12:37:42 +04:00
kent@kent-amd64.(none)
be15e3bc15 Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-23 20:20:40 +01:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
monty@mysql.com/narttu.mysql.fi
a6481aa4c7 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2006-12-15 01:01:52 +02:00
monty@mysql.com/narttu.mysql.fi
88dd873de0 Fixed compiler warnings detected by option -Wshadow and -Wunused:
- Removed not used variables and functions
- Added #ifdef around code that is not used
- Renamed variables and functions to avoid conflicts
- Removed some not used arguments

Fixed some class/struct warnings in ndb
Added define IS_LONGDATA() to simplify code in libmysql.c

I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
2006-12-15 00:51:37 +02:00
pgalbraith@bk-internal.mysql.com
23f0c6d765 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
2006-12-09 02:34:42 +01:00
holyfoot/hf@deer.(none)
edfbcc12cb Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/embt/my51-embt
2006-12-08 15:49:43 +04:00
holyfoot/hf@mysql.com/deer.(none)
4091806268 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/embt/my50-embt
2006-12-08 15:22:46 +04:00
holyfoot/hf@mysql.com/deer.(none)
f83bedabed Merge bk@192.168.21.1:mysql-4.1-opt
into  mysql.com:/home/hf/work/embt/my41-embt
2006-12-08 15:15:33 +04:00
baker@bk-internal.mysql.com
37f7e29db2 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
2006-12-06 20:26:10 +01:00
msvensson@neptunus.(none)
128b73fc36 Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-12-04 19:28:38 +01:00
msvensson@neptunus.(none)
971c783f7d Merge neptunus.(none):/home/msvensson/mysql/mysql-5.1
into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-maint
2006-12-04 19:11:55 +01:00
gkodinov@dl145s.mysql.com
ddf219d21a Merge dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE2/mysql-5.0
into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE2/mysql-5.1
2006-12-04 18:08:50 +01:00
gkodinov@dl145s.mysql.com
d253588c69 Merge dl145s.mysql.com:/data0/bk/team_tree_merge/mysql-5.0-opt
into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE2/mysql-5.0
2006-12-04 18:05:42 +01:00
gkodinov/kgeorge@macbook.gmz
063fe51c69 item_func.cc:
fixed a valgrind warning
type_varchar.test:
  fixed a valgrind warning
2006-12-04 14:26:05 +02:00
baker@bk-internal.mysql.com
dbe5f0acc5 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-arch
2006-12-03 21:19:35 +01:00
brian@zim.(none)
31d67280f7 This finishes the work (someone) started to remove FIELD_ types and use the Enum MYSQL types. The second part to this is to actually deprecate the FIELD defines in mysql_com.h 2006-12-01 17:26:52 -08:00
df@kahlann.erinye.com
da7820c37d Merge dfischer@bk-internal.mysql.com:/home/bk/mysql-5.0-marvel
into  kahlann.erinye.com:/home/df/mysql/build/mysql-5.0-build
2006-12-01 13:02:54 +01:00
monty@narttu.mysql.fi
693b906f6e Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2006-11-30 23:27:16 +02:00
monty@mysql.com/narttu.mysql.fi
3d40956039 Fixed portability issue in my_thr_init.c (was added in my last push)
Fixed compiler warnings (detected by VC++):
- Removed not used variables
- Added casts
- Fixed wrong assignments to bool
- Fixed wrong calls with bool arguments
- Added missing argument to store(longlong), which caused wrong store method to be called.
2006-11-30 18:25:05 +02:00
monty@mysql.com/narttu.mysql.fi
3a35c30027 Fixed compiler warnings (Mostly VC++):
- Removed not used variables
- Changed some ulong parameters/variables to ulonglong (possible serious bug)
- Added casts to get rid of safe assignment from longlong to long (and similar)
- Added casts to function parameters
- Fixed signed/unsigned compares
- Added some constructores to structures
- Removed some not portable constructs

Better fix for bug Bug #21428 "skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown"
(Added new parameter to net_clear() to define when we want the communication buffer to be emptied)
2006-11-30 03:40:42 +02:00
kostja@bodhi.local
966c569b94 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-11-29 23:36:26 +03:00
msvensson@shellback.(none)
7ddc43e305 Merge shellback.(none):/home/msvensson/mysql/mysql-5.1
into  shellback.(none):/home/msvensson/mysql/mysql-5.1-maint
2006-11-29 15:44:09 +01:00
kostja@bodhi.local
2525e16c73 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-11-29 11:44:37 +03:00
kostja@bodhi.local
5fea0724bc Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2006-11-29 02:44:12 +03:00
msvensson@neptunus.(none)
04d5a42bbf Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-11-28 20:59:57 +01:00
gkodinov@dl145s.mysql.com
32c9e11df9 Merge bk-internal:/home/bk/mysql-5.1
into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE/mysql-5.1-opt
2006-11-28 17:14:16 +01:00
monty@mysql.com/nosik.monty.fi
fa81a82e7f Fixed a LOT of compiler warnings
Added missing DBUG_RETURN statements (in mysqldump.c)
Added missing enums
Fixed a lot of wrong DBUG_PRINT() statements, some of which could cause crashes
Removed usage of %lld and %p in printf strings as these are not portable or produces different results on different systems.
2006-11-27 01:47:38 +02:00
tnurnberg@salvation.intern.azundris.com
655056d32f Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Fix tests for new behaviour: an error is thrown if a NON DETERMINISTIC
stored function (SF) is called during statement-based replication (SBR).
2006-11-17 21:30:28 +01:00
holyfoot/hf@deer.(none)
7d190dd6b1 Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/mysql-5.1-mrg
2006-11-17 19:01:35 +04:00
holyfoot/hf@mysql.com/deer.(none)
e95e23b0f3 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/mysql-5.0-0mrg
2006-11-17 10:30:16 +04:00
malff/marcsql@weblab.(none)
e8d51e62bb Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-22684
2006-11-16 10:06:36 -07:00
malff/marcsql@weblab.(none)
ccfbd68615 Bug#22684 (BENCHMARK, ENCODE, DECODE and FORMAT are not real functions)
Before this change, the functions BENCHMARK, ENCODE, DECODE and FORMAT could
only accept a constant for some parameters.

After this change, this restriction has been removed. An implication is that
these functions can also be used in prepared statements.

The change consist of changing the following classes:
- Item_func_benchmark
- Item_func_encode
- Item_func_decode
- Item_func_format
to:
- only accept Item* in the constructor,
- and evaluate arguments during calls to val_xxx()
which fits the general design of all the other functions.

The 'TODO' items identified in item_create.cc during the work done for
Bug 21114 are addressed by this fix, as a natural consequence of aligning
the design.

In the 'func_str' test, a single very long test line involving an explain
extended select with many functions has been rewritten into multiple
separate tests, to improve maintainability.
The result of explain extended select decode(encode(...)) has changed,
since the encode and decode functions now print all their parameters.
2006-11-16 09:03:47 -07:00
cmiller@zippy.cornsilk.net
cba50775f7 Merge bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
2006-11-15 12:29:24 -05:00
cmiller@zippy.cornsilk.net
11b5d3fabc Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug19955/my50-bug19955
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
2006-11-15 12:27:09 -05:00
cmiller@zippy.cornsilk.net
19b3bf2963 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug19955/my50-bug19955
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug19955/my51-bug19955
2006-11-15 12:24:21 -05:00
cmiller@zippy.cornsilk.net
5d4c57b900 Bug#19955: unsigned bigint used as signed with MOD function
Problem:  When we have a really large number (between 2^63 and 2^64)
as the left side of the mod operator, it gets improperly corerced
into a signed value.

Solution:  Added check to see if the "negative" number is really
positive, and if so, cast it.
2006-11-15 12:23:07 -05:00
tnurnberg@salvation.intern.azundris.com
c5c46ca483 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  salvation.intern.azundris.com:/home/tnurnberg/work/mysql-5.1-maint-16456
2006-11-15 01:58:11 +01:00
tnurnberg@salvation.intern.azundris.com
ea3bf1b247 Bug#16456 "RBR: rpl_sp.test expects query to fail, but passes in RBR"
calling (rather than defining) non-deterministic SP in SBR (as opposed
to RBR or mixed) will throw an error now.

require mixed mode for tests now. SBR will now fail when calling
non-deter SPs and SFs (as it should), and RBR already failed by virtue of
giving different results for "show binlog" than the results-file has.
also test for 16456 now. lastly make amends because one of the tests
fails with a new error # now as code was added to sql_trigger.cc while
test was disabled.
2006-11-15 01:27:39 +01:00
cmiller@zippy.cornsilk.net
fbfeccfe91 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug18761/my51-bug18761
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
2006-11-13 13:19:49 -05:00
cmiller@zippy.cornsilk.net
ff26bf49c8 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug18761/my50-bug18761
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
2006-11-13 13:19:13 -05:00
cmiller@zippy.cornsilk.net
6d97850c3b Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug18761/my50-bug18761
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug18761/my51-bug18761
2006-11-13 13:17:02 -05:00
cmiller@zippy.cornsilk.net
8471897fbc Bug#18761: constant expression as UDF parameters not passed in as constant
The code that set up data to be passed to user-defined functions was very
old and analyzed the "Type" of the data that was passed into the UDF, when
it really should analyze the "return_type", which is hard-coded for simple
Items and works correctly for complex ones like functions.
---
Added test at Sergei's behest.
2006-11-13 13:13:44 -05:00
holyfoot/hf@deer.(none)
385541131b Merge mysql.com:/home/hf/work/embt/my50-embt
into  mysql.com:/home/hf/work/embt/my51-embt
2006-11-13 20:16:46 +04:00
dlenev@mockturtle.local
8a5db3e974 Small adjustment after merging fix for bug#23651 "Server crashes when
trigger which uses stored function invoked from different connections"
into 5.1.
2006-11-13 14:30:12 +03:00
dlenev@mockturtle.local
d8aad85fe9 Merge mockturtle.local:/home/dlenev/src/mysql-5.0-bg23651
into  mockturtle.local:/home/dlenev/src/mysql-5.1-merge
2006-11-13 11:29:40 +03:00
dlenev@mockturtle.local
6fd6e099c9 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mockturtle.local:/home/dlenev/src/mysql-5.0-bg23651
2006-11-13 11:15:02 +03:00
dlenev@mockturtle.local
dd1a4f5742 Fix for bug bug#23651 "Server crashes when trigger which uses
stored function invoked from different connections".

Invocation of trigger which was using stored function from different
connections caused server crashes (for non-debug server this happened
in highly concurrent environment, but debug server failed on assertion
in relatively simple scenario).

Item_func_sp was not safe to use in triggers (in other words for
re-execution from different threads) as artificial TABLE object
pointed by Item_func_sp::dummy_table referenced incorrect THD
object. To fix the problem we force re-initialization of this
object for each re-execution of statement.
2006-11-13 11:10:49 +03:00
holyfoot/hf@mysql.com/deer.(none)
7805cdef84 Merge mysql.com:/home/hf/work/embt/my41-embt
into  mysql.com:/home/hf/work/embt/my50-embt
2006-11-13 10:45:22 +04:00
holyfoot/hf@mysql.com/deer.(none)
6e0045ed20 embedded-mode tests fixed 2006-11-13 10:39:15 +04:00
holyfoot/hf@deer.(none)
09c0569b6d Merge bk@192.168.21.1:mysql-5.1-opt
into  mysql.com:/home/hf/work/8663/my51-8663
2006-11-09 16:10:15 +04:00
cmiller@zippy.cornsilk.net
f05faf34af Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug10963/my50-bug10963
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug10963/my51-bug10963
2006-11-08 10:12:06 -05:00
cmiller@zippy.cornsilk.net
6260e12b99 Bug#10963: LEFT/RIGHT/SUBSTR/.. string functions returns wrong result \
on large length
  
Problem:  Most (all) of the numeric inputs were being coerced into
int (32 bit) sized variables.  Works OK for sane inputs; any input
larger than 2^32 (or 2^31 for signed vars) exihibited predictable
wrapping behavior (up to about 10^18) and then started having really
strange behaviour past that point (since the conversion to 64 bit int
from the DECIMAL type can do weird things on out of range numbers).

Solution: 1)  Add many tests.  2)  Convert input from (u)long type to
(u)longlong.  3)  Do (sometimes multiple) sanity checks on input,
keeping in mind that sometimes a negative longlong is not a negative
longlong (if the unsigned_flag is set).  4) Emulate existing behavior
w/rt negative and "small" out-of-bounds values.
2006-11-08 10:11:02 -05:00
holyfoot/hf@deer.(none)
938ba3e11e Merge mysql.com:/home/hf/work/mysql-5.0.clean
into  mysql.com:/home/hf/work/mysql-5.1.clean
2006-11-08 19:09:39 +04:00
cmiller@zippy.cornsilk.net
a759280347 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug23411/my50-bug23411
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug23411/my51-bug23411
2006-11-06 17:46:50 -05:00
cmiller@zippy.cornsilk.net
40170fbf58 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug23411/my41-bug23411
into  zippy.cornsilk.net:/home/cmiller/work/mysql/bug23411/my50-bug23411
2006-11-06 17:45:47 -05:00
cmiller@zippy.cornsilk.net
87a5134b7c Bug#23411: ... MOD-ing zero returns strange result
The Item_func_mod objects never had maybe_null set, so users had no reason 
to expect that they can be NULL, and may therefore deduce wrong results.
Now, set maybe_null.
2006-11-06 17:13:19 -05:00
holyfoot/hf@mysql.com/deer.(none)
fca6f71435 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/8663/my50-8663
2006-11-06 14:57:47 +04:00
holyfoot/hf@deer.(none)
7e1c6b480d Merge mysql.com:/home/hf/work/8663/my50-8663
into  mysql.com:/home/hf/work/8663/my51-8663
2006-11-06 11:01:35 +04:00
kostja@bodhi.local
6a28c436f7 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  bodhi.local:/opt/local/work/mysql-4.1-runtime
2006-11-02 01:08:39 +03:00
gkodinov/kgeorge@rakia.gmz
1c6ede6aac Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rakia.gmz:/home/kgeorge/mysql/autopush/B21809-5.0-opt
2006-10-31 16:15:35 +02:00
holyfoot/hf@mysql.com/deer.(none)
18577a8e8f Bug #8663 (cant use bigint as input to CAST)
decimal->ulong conversion fixed to assign max possible ULONG if decimal
is bigger
Item_func_unsigned now handles DECIMAL parameter separately as we can't
rely on decimal::val_int result here.
2006-10-30 09:52:50 +04:00
gkodinov/kgeorge@macbook.gmz
932d86bbb9 Bug #21809: Error 1356 while selecting from view with grouping though underlying
select OK.
The SQL parser was using Item::name to transfer user defined function attributes
to the user defined function (udf). It was not distinguishing between user defined 
function call arguments and stored procedure call arguments. Setting Item::name 
was causing Item_ref::print() method to print the argument as quoted identifiers 
and caused views that reference aggregate functions as udf call arguments (and 
rely on Item::print() for the text of the view to store) to throw an undefined 
identifier error.
Overloaded Item_ref::print to print aggregate functions as such when printing
the references to aggregate functions taken out of context by split_sum_func2()
Fixed the parser to properly detect using AS clause in stored procedure arguments
as an error.
Fixed printing the arguments of udf call to print properly the udf attribute.
2006-10-24 15:26:41 +03:00
kroki/tomash@moonlight.intranet
ee0cebf9a7 BUG#21726: Incorrect result with multiple invocations of LAST_INSERT_ID.
Note: bug#21726 does not directly apply to 4.1, as it doesn't have stored
procedures.  However, 4.1 had some bugs that were fixed in 5.0 by the
patch for bug#21726, and this patch is a backport of those fixes.
Namely, in 4.1 it fixes:

  - LAST_INSERT_ID(expr) didn't return value of expr (4.1 specific).

  - LAST_INSERT_ID() could return the value generated by current
    statement if the call happens after the generation, like in

      CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY, j INT);
      INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());

  - Redundant binary log LAST_INSERT_ID_EVENTs could be generated.
2006-10-06 13:34:07 +04:00
kroki/tomash@moonlight.intranet
8798b462b5 Fix for the patch for bug#21726: Incorrect result with multiple
invocations of LAST_INSERT_ID.

Reding of LAST_INSERT_ID inside stored function wasn't noted by caller,
and no LAST_INSERT_ID_EVENT was issued for binary log.

The solution is to add THD::last_insert_id_used_bin_log, which is much
like THD::last_insert_id_used, but is reset only for upper-level
statements.  This new variable is used to issue LAST_INSERT_ID_EVENT.
2006-10-03 13:38:16 +04:00
bar@mysql.com/bar.intranet.mysql.r18.ru
72ad606ece Merge mysql.com:/usr/home/bar/mysql-4.1.b8663
into  mysql.com:/usr/home/bar/mysql-4.1-rpl
2006-10-03 11:53:01 +05:00
kroki/tomash@moonlight.intranet
5ea8adfae7 BUG#21726: Incorrect result with multiple invocations of LAST_INSERT_ID
Non-upper-level INSERTs (the ones in the body of stored procedure,
stored function, or trigger) into a table that have AUTO_INCREMENT
column didn't affected the result of LAST_INSERT_ID() on this level.

The problem was introduced with the fix of bug 6880, which in turn was
introduced with the fix of bug 3117, where current insert_id value was
remembered on the first call to LAST_INSERT_ID() (bug 3117) and was
returned from that function until it was reset before the next
_upper-level_ statement (bug 6880).

The fix for bug#21726 brings back the behaviour of version 4.0, and
implements the following: remember insert_id value at the beginning
of the statement or expression (which at that point equals to
the first insert_id value generated by the previous statement), and
return that remembered value from LAST_INSERT_ID() or @@LAST_INSERT_ID.

Thus, the value returned by LAST_INSERT_ID() is not affected by values
generated by current statement, nor by LAST_INSERT_ID(expr) calls in
this statement.

Version 5.1 does not have this bug (it was fixed by WL 3146).
2006-10-02 14:28:23 +04:00
gkodinov@dl145s.mysql.com
cf9d1c9152 Merge bk-internal:/home/bk/mysql-5.0
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
2006-09-18 19:01:07 +04:00
gkodinov@dl145s.mysql.com
ce8ed889d7 Merge dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1
2006-09-18 12:57:20 +02:00
gkodinov@dl145s.mysql.com
b1e087a717 Merge dl145s.mysql.com:/data/bk/team_tree_merge/CLEAN/mysql-5.0
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt
2006-09-15 11:52:49 +02:00
kaa@polly.local
46f2a4dbc6 Fixed the faulty merge 2006-09-13 21:25:33 +04:00
kaa@polly.local
b9811a6df1 Fixed the faulty merge 2006-09-13 19:32:21 +04:00
kaa@polly.local
cccc3da13a Merge polly.local:/tmp/20924/bug20294/my50-bug20294
into  polly.local:/home/kaa/src/maint/m50-maint--07OGt
2006-09-13 16:06:59 +04:00
kaa@polly.local
61e3f8eae1 Merge polly.local:/tmp/20924/bug20294/my50-bug20294
into  polly.local:/tmp/20924/bug20294/my51-bug20294
2006-09-13 16:00:15 +04:00
kaa@polly.local
e812ae873d Merge polly.local:/tmp/20924/bug20294/my41-bug20294
into  polly.local:/tmp/20924/bug20294/my50-bug20294
2006-09-13 15:18:14 +04:00
kaa@polly.local
397f0df9ad Cset exclude: kaa@polly.local|ChangeSet|20060912122540|09861
Cset exclude: kaa@polly.local|ChangeSet|20060908100829|09983
2006-09-13 14:41:28 +04:00
kaa@polly.local
6060b5bb50 Merge polly.local:/tmp/20924/bug20294/my50-bug20294
into  polly.local:/home/kaa/src/maint/m50-maint--07OGt
2006-09-12 19:35:44 +04:00
kaa@polly.local
ca48b7af0c Merge polly.local:/tmp/20924/bug20294/my50-bug20294
into  polly.local:/tmp/20924/bug20294/my51-bug20294
2006-09-12 18:43:38 +04:00
kaa@polly.local
13331b8d24 Fixed compilation 2006-09-12 18:28:36 +04:00
kaa@polly.local
e03faff3e4 Merge polly.local:/tmp/20924/bug20294/my41-bug20294
into  polly.local:/tmp/20924/bug20294/my50-bug20294
2006-09-12 17:57:15 +04:00
kaa@polly.local
5df7611caa Post-review fixes for bug #20924 2006-09-12 16:25:40 +04:00
igor@rurik.mysql.com
9c15b7e0e8 Post-pushbuild corrections for fix of bug #21698. 2006-09-09 09:43:09 -07:00
kaa@polly.local
268c7a3522 Bug #20924: CAST(expr as UNSIGNED) returns SIGNED value when used in various functions
- Honor unsigned_flag in the corresponding functions
- Use compare_int_signed_unsigned()/compare_int_unsigned_signed() instead of explicit comparison in GREATEST() and LEAST()
2006-09-08 14:08:29 +04:00
igor@rurik.mysql.com
34206c6f80 Fixed bug #21698: erroneously a field could be replaced by an
equal constant under any circumstances.
In fact this substitution can be allowed if the field is
not of a type string or if the field reference serves as 
an argument of a comparison predicate.
2006-09-07 11:06:37 -07:00
evgen@moonbone.local
e1c245bff3 Merge moonbone.local:/home/evgen/bk-trees/mysql-5.1-opt
into  moonbone.local:/work/tmp_merge-5.1-mysql
2006-09-01 14:08:38 +04:00
kostja@bodhi.local
ebb7070430 Merge bodhi.local:/opt/local/work/mysql-5.0-runtime-safemerge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-08-30 03:00:19 +04:00
kostja@bodhi.local
f8d34e1030 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-14897
2006-08-30 00:45:33 +04:00
evgen@moonbone.local
8cf9781717 Merge moonbone.local:/work/tmp_merge-5.0-mysql
into  moonbone.local:/work/tmp_merge-5.1-opt-mysql
2006-08-29 18:58:50 +04:00
kroki/tomash@moonlight.intranet
b6bee0a394 BUG#21166: Prepared statement causes signal 11 on second execution
Changes in an item tree done by optimizer weren't properly
registered and went unnoticed, which resulted in preliminary freeing
of used memory.
2006-08-24 15:49:12 +04:00
evgen@moonbone.local
44cad14bf4 item_cmpfunc.cc, item.cc:
Additional fix for bug #21475
item_func.h, item_func.cc:
  Additional fix for bug#16861
2006-08-23 01:03:28 +04:00
evgen@sunlight.local
f17a536e09 Fixed bug#16861: User defined variable can have a wrong value if a tmp table was
used.

Sorting by RAND() uses a temporary table in order to get a correct results.
User defined variable was set during filling the temporary table and later
on it is substituted for its value from the temporary table. Due to this
it contains the last value stored in the temporary table.

Now if the result_field is set for the Item_func_set_user_var object it 
updates variable from the result_field value when being sent to a client.

The Item_func_set_user_var::check() now accepts a use_result_field
parameter. Depending on its value the result_field or the args[0] is used
to get current value.
2006-08-22 17:37:41 +04:00
rburnett@bk-internal.mysql.com
344dd03774 Merge bk-internal.mysql.com:/data0/bk/mysql-5.1
into  bk-internal.mysql.com:/data0/bk/mysql-5.1-kt
2006-08-15 17:58:39 +02:00
kostja@bodhi.local
04c97488f9 Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-08-12 21:06:51 +04:00
gluh@mysql.com/gluh.(none)
7e07425b2b Bug#16172 DECIMAL data type processed incorrectly
issue an 'overflow warning' if result value is bigger than max possible value
2006-08-08 16:03:42 +05:00
msvensson@neptunus.(none)
7280f63100 Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-08-03 09:32:58 +02:00
kostja@bodhi.local
1b145118b9 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge
2006-08-02 21:54:10 +04:00
evgen@sunlight.local
ef4f149536 Merge sunlight.local:/local_work/tmp_merge-5.0-opt-mysql
into  sunlight.local:/local_work/tmp_merge-5.1-opt-mysql
2006-07-30 00:33:24 +04:00
kostja@bodhi.local
73189969f3 Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-07-26 23:33:25 +04:00
evgen@moonbone.local
b7ade8e408 item_func.h, item_func.cc, sql_select.cc, item.h:
Post review changes for bug#19862.
2006-07-26 21:36:03 +04:00
evgen@moonbone.local
4ee2e07cc0 Fixed bug#19862: Sort with filesort by function evaluates function twice
When there is no index defined filesort is used to sort the result of a
query. If there is a function in the select list and the result set should be
ordered by it's value then this function will be evaluated twice. First time to
get the value of the sort key and second time to send its value to a user.
This happens because filesort when sorts a table remembers only values of its
fields but not values of functions.
All functions are affected. But taking into account that SP and UDF functions
can be both expensive and non-deterministic a temporary table should be used 
to store their results and then sort it to avoid twice SP evaluation and to 
get a correct result.

If an expression referenced in an ORDER clause contains a SP or UDF 
function, force the use of a temporary table.

A new Item_processor function called func_type_checker_processor is added
to check whether the expression contains a function of a particular type.
2006-07-26 00:31:29 +04:00
msvensson@neptunus.(none)
cb23cd759e Merge neptunus.(none):/home/msvensson/mysql/bug7498/my50-bug7498
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-07-20 13:41:50 +02:00
kostja@bodhi.local
d7845b74db Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge-5.0
2006-07-13 22:09:36 +04:00
kroki/tomash@moonlight.intranet
a3ea06db41 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug18630
2006-07-13 17:21:44 +04:00
kroki/tomash@moonlight.intranet
4272d1efc3 Bug#18630: Arguments of suid routine calculated in wrong security
context.

Routine arguments were evaluated in the security context of the routine
itself, not in the caller's context.

The bug is fixed the following way:

  - Item_func_sp::find_and_check_access() has been split into two
    functions: Item_func_sp::find_and_check_access() itself only
    finds the function and check that the caller have EXECUTE privilege
    on it.  New function set_routine_security_ctx() changes security
    context for SUID routines and checks that definer have EXECUTE
    privilege too.

  - new function sp_head::execute_trigger() is called from
    Table_triggers_list::process_triggers() instead of
    sp_head::execute_function(), and is effectively just as the
    sp_head::execute_function() is, with all non-trigger related code
    removed, and added trigger-specific security context switch.

  - call to Item_func_sp::find_and_check_access() stays outside
    of sp_head::execute_function(), and there is a code in
    sql_parse.cc before the call to sp_head::execute_procedure() that
    checks that the caller have EXECUTE privilege, but both
    sp_head::execute_function() and sp_head::execute_procedure() call
    set_routine_security_ctx() after evaluating their parameters,
    and restore the context after the body is executed.
2006-07-13 17:12:31 +04:00
guilhem@gbichot3.local
0594e1b84b WL#3146 "less locking in auto_increment":
this is a cleanup patch for our current auto_increment handling:
new names for auto_increment variables in THD, new methods to manipulate them
(see sql_class.h), some move into handler::, causing less backup/restore
work when executing substatements. 
This makes the logic hopefully clearer, less work is is needed in
mysql_insert().
By cleaning up, using different variables for different purposes (instead
of one for 3 things...), we fix those bugs, which someone may want to fix
in 5.0 too:
BUG#20339 "stored procedure using LAST_INSERT_ID() does not replicate
statement-based"
BUG#20341 "stored function inserting into one auto_increment puts bad
data in slave"
BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY UPDATE"
(now if a row is updated, LAST_INSERT_ID() will return its id)
and re-fixes:
BUG#6880 "LAST_INSERT_ID() value changes during multi-row INSERT"
(already fixed differently by Ramil in 4.1)
Test of documented behaviour of mysql_insert_id() (there was no test).
The behaviour changes introduced are:
- LAST_INSERT_ID() now returns "the first autogenerated auto_increment value
successfully inserted", instead of "the first autogenerated auto_increment
value if any row was successfully inserted", see auto_increment.test.
Same for mysql_insert_id(), see mysql_client_test.c.
- LAST_INSERT_ID() returns the id of the updated row if ON DUPLICATE KEY
UPDATE, see auto_increment.test. Same for mysql_insert_id(), see
mysql_client_test.c.
- LAST_INSERT_ID() does not change if no autogenerated value was successfully 
inserted (it used to then be 0), see auto_increment.test.
- if in INSERT SELECT no autogenerated value was successfully inserted,
mysql_insert_id() now returns the id of the last inserted row (it already
did this for INSERT VALUES), see mysql_client_test.c.
- if INSERT SELECT uses LAST_INSERT_ID(X), mysql_insert_id() now returns X
(it already did this for INSERT VALUES), see mysql_client_test.c.
- NDB now behaves like other engines wrt SET INSERT_ID: with INSERT IGNORE,
the id passed in SET INSERT_ID is re-used until a row succeeds; SET INSERT_ID
influences not only the first row now.

Additionally, when unlocking a table we check that the thread is not keeping
a next_insert_id (as the table is unlocked that id is potentially out-of-date);
forgetting about this next_insert_id is done in a new
handler::ha_release_auto_increment().

Finally we prepare for engines capable of reserving finite-length intervals
of auto_increment values: we store such intervals in THD. The next step
(to be done by the replication team in 5.1) is to read those intervals from
THD and actually store them in the statement-based binary log. NDB
will be a good engine to test that.
2006-07-09 17:52:19 +02:00
kostja@bodhi.local
2ab1e065e4 Fix compiler warnings in sql_udf.h: ISO C++ forbids casting
between pointer to function and pointer to object.
2006-07-09 13:03:51 +04:00
knielsen@mysql.com
1d56a9720c BUG#20769: Dangling pointer in ctype_recoding test case.
In some functions dealing with strings and character sets, the wrong
pointers were saved for restoration in THD::rollback_item_tree_changes().
This could potentially cause random corruption or crashes.

Fixed by passing the original Item ** locations, not local stack copies.

Also remove unnecessary use of default arguments.
2006-06-30 09:26:36 +02:00
evgen@moonbone.local
79c91f6214 Manually merged 2006-06-18 14:56:35 +04:00
ramil@mysql.com
10914578f1 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/usr/home/ram/work/mysql-5.0
2006-06-16 16:43:44 +05:00
serg@serg.mylan
d00b56549c String::set(double) and set(longlong) -> set_real() and set_int()
fix Field::store(double) being used instead of store(longlong)

NB: overloading functions is evil
2006-06-16 12:17:20 +02:00
ramil@mysql.com
f2899063ee after-merge fixes. 2006-06-16 14:05:58 +05:00
serg@serg.mylan
816bd73362 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
2006-06-16 10:01:13 +02:00
serg@serg.mylan
16861b2e3b Bug#14708: Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index
Don't rely on table->null_row when no index is used - it may be a multi-table search
2006-06-16 09:49:18 +02:00
serg@serg.mylan
99fd8f728b cleanup String::set(integer) 2006-06-14 23:09:03 +02:00
bar@mysql.com
a481a35237 Bug#8663 cant use bgint unsigned as input to cast
Problem: cast to unsigned limited result to 
max signed bigint 9223372036854775808,
instead of max unsigned bigint 18446744073709551615.

Fix: don't use args[0]->val_int() when casting from
a floating point number, use val() instead, with range checkings,
special to unsigned data type.

item_func.cc:
  Special handling of cast from REAL_RESULT
  to unsigned int: we cannot execute args[0]->val_int()
  because it cuts max allowed value to LONGLONG_INT,
  instead of ULONGLONG_INT required.
count_distinct3.test:
  Getting rid of "Data truncated; out of range ..." warnings.
cast.test, cast.result:
  Adding test case.
ps.result:
  Fixing that cast from 6570515219.6535 
  to unsigned didn't round to 6570515220,
  and returned 6570515219 instead.
2006-06-14 13:40:21 +05:00
serg@serg.mylan
2d8f78e402 Bug#14708: Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index
Don't rely on table->null_row when no index is used - it may be a multi-table
2006-06-14 09:19:02 +02:00
msvensson@neptunus.(none)
9ebf7944e3 Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
- Add unsigned flag to user_var_entry, used when 'type' is INT_RESULT
- Propagate unsigned flag from the query executed by Item_single_row_subselect
2006-06-09 19:35:54 +02:00
ramil@mysql.com
0bdae38efb Fix for bug #6880: LAST_INSERT_ID() within a statement 2006-06-07 14:01:10 +05:00
monty@mysql.com
c46fb742b8 Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new
into  mysql.com:/home/my/mysql-5.1
2006-06-04 21:05:22 +03:00
monty@mysql.com
74cc73d461 This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),

- New optional handler function introduced: reset()
  This is called after every DML statement to make it easy for a handler to
  statement specific cleanups.
  (The only case it's not called is if force the file to be closed)

- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
  should be moved to handler::reset()

- table->read_set contains a bitmap over all columns that are needed
  in the query.  read_row() and similar functions only needs to read these
  columns
- table->write_set contains a bitmap over all columns that will be updated
  in the query. write_row() and update_row() only needs to update these
  columns.
  The above bitmaps should now be up to date in all context
  (including ALTER TABLE, filesort()).

  The handler is informed of any changes to the bitmap after
  fix_fields() by calling the virtual function
  handler::column_bitmaps_signal(). If the handler does caching of
  these bitmaps (instead of using table->read_set, table->write_set),
  it should redo the caching in this code. as the signal() may be sent
  several times, it's probably best to set a variable in the signal
  and redo the caching on read_row() / write_row() if the variable was
  set.

- Removed the read_set and write_set bitmap objects from the handler class

- Removed all column bit handling functions from the handler class.
  (Now one instead uses the normal bitmap functions in my_bitmap.c instead
  of handler dedicated bitmap functions)

- field->query_id is removed. One should instead instead check
  table->read_set and table->write_set if a field is used in the query.

- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
  handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
  instead use table->read_set to check for which columns to retrieve.

- If a handler needs to call Field->val() or Field->store() on columns
  that are not used in the query, one should install a temporary
  all-columns-used map while doing so. For this, we provide the following
  functions:

  my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
  field->val();
  dbug_tmp_restore_column_map(table->read_set, old_map);

  and similar for the write map:

  my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
  field->val();
  dbug_tmp_restore_column_map(table->write_set, old_map);

  If this is not done, you will sooner or later hit a DBUG_ASSERT
  in the field store() / val() functions.
  (For not DBUG binaries, the dbug_tmp_restore_column_map() and
  dbug_tmp_restore_column_map() are inline dummy functions and should
  be optimized away be the compiler).

- If one needs to temporary set the column map for all binaries (and not
  just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
  methods) one should use the functions tmp_use_all_columns() and
  tmp_restore_column_map() instead of the above dbug_ variants.

- All 'status' fields in the handler base class (like records,
  data_file_length etc) are now stored in a 'stats' struct. This makes
  it easier to know what status variables are provided by the base
  handler.  This requires some trivial variable names in the extra()
  function.

- New virtual function handler::records().  This is called to optimize
  COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
  (stats.records is not supposed to be an exact value. It's only has to
  be 'reasonable enough' for the optimizer to be able to choose a good
  optimization path).

- Non virtual handler::init() function added for caching of virtual
  constants from engine.

- Removed has_transactions() virtual method. Now one should instead return
  HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
  transactions.

- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
  that is to be used with 'new handler_name()' to allocate the handler
  in the right area.  The xxxx_create_handler() function is also
  responsible for any initialization of the object before returning.

  For example, one should change:

  static handler *myisam_create_handler(TABLE_SHARE *table)
  {
    return new ha_myisam(table);
  }

  ->

  static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
  {
    return new (mem_root) ha_myisam(table);
  }

- New optional virtual function: use_hidden_primary_key().
  This is called in case of an update/delete when
  (table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
  but we don't have a primary key. This allows the handler to take precisions
  in remembering any hidden primary key to able to update/delete any
  found row. The default handler marks all columns to be read.

- handler::table_flags() now returns a ulonglong (to allow for more flags).

- New/changed table_flags()
  - HA_HAS_RECORDS	    Set if ::records() is supported
  - HA_NO_TRANSACTIONS	    Set if engine doesn't support transactions
  - HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
                            Set if we should mark all primary key columns for
			    read when reading rows as part of a DELETE
			    statement. If there is no primary key,
			    all columns are marked for read.
  - HA_PARTIAL_COLUMN_READ  Set if engine will not read all columns in some
			    cases (based on table->read_set)
 - HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
   			    Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
 - HA_DUPP_POS              Renamed to HA_DUPLICATE_POS
 - HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
			    Set this if we should mark ALL key columns for
			    read when when reading rows as part of a DELETE
			    statement. In case of an update we will mark
			    all keys for read for which key part changed
			    value.
  - HA_STATS_RECORDS_IS_EXACT
			     Set this if stats.records is exact.
			     (This saves us some extra records() calls
			     when optimizing COUNT(*))
			    

- Removed table_flags()
  - HA_NOT_EXACT_COUNT     Now one should instead use HA_HAS_RECORDS if
			   handler::records() gives an exact count() and
			   HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
  - HA_READ_RND_SAME	   Removed (no one supported this one)

- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()

- Renamed handler::dupp_pos to handler::dup_pos

- Removed not used variable handler::sortkey


Upper level handler changes:

- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
  cache is updated on engine creation time and updated on open.


MySQL level changes (not obvious from the above):

- DBUG_ASSERT() added to check that column usage matches what is set
  in the column usage bit maps. (This found a LOT of bugs in current
  column marking code).

- In 5.1 before, all used columns was marked in read_set and only updated
  columns was marked in write_set. Now we only mark columns for which we
  need a value in read_set.

- Column bitmaps are created in open_binary_frm() and open_table_from_share().
  (Before this was in table.cc)

- handler::table_flags() calls are replaced with handler::ha_table_flags()

- For calling field->val() you must have the corresponding bit set in
  table->read_set. For calling field->store() you must have the
  corresponding bit set in table->write_set. (There are asserts in
  all store()/val() functions to catch wrong usage)

- thd->set_query_id is renamed to thd->mark_used_columns and instead
  of setting this to an integer value, this has now the values:
  MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
  Changed also all variables named 'set_query_id' to mark_used_columns.

- In filesort() we now inform the handler of exactly which columns are needed
  doing the sort and choosing the rows.

- The TABLE_SHARE object has a 'all_set' column bitmap one can use
  when one needs a column bitmap with all columns set.
  (This is used for table->use_all_columns() and other places)

- The TABLE object has 3 column bitmaps:
  - def_read_set     Default bitmap for columns to be read
  - def_write_set    Default bitmap for columns to be written
  - tmp_set          Can be used as a temporary bitmap when needed.
  The table object has also two pointer to bitmaps read_set and write_set
  that the handler should use to find out which columns are used in which way.

- count() optimization now calls handler::records() instead of using
  handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).

- Added extra argument to Item::walk() to indicate if we should also
  traverse sub queries.

- Added TABLE parameter to cp_buffer_from_ref()

- Don't close tables created with CREATE ... SELECT but keep them in
  the table cache. (Faster usage of newly created tables).


New interfaces:

- table->clear_column_bitmaps() to initialize the bitmaps for tables
  at start of new statements.

- table->column_bitmaps_set() to set up new column bitmaps and signal
  the handler about this.

- table->column_bitmaps_set_no_signal() for some few cases where we need
  to setup new column bitmaps but don't signal the handler (as the handler
  has already been signaled about these before). Used for the momement
  only in opt_range.cc when doing ROR scans.

- table->use_all_columns() to install a bitmap where all columns are marked
  as use in the read and the write set.

- table->default_column_bitmaps() to install the normal read and write
  column bitmaps, but not signaling the handler about this.
  This is mainly used when creating TABLE instances.

- table->mark_columns_needed_for_delete(),
  table->mark_columns_needed_for_delete() and
  table->mark_columns_needed_for_insert() to allow us to put additional
  columns in column usage maps if handler so requires.
  (The handler indicates what it neads in handler->table_flags())

- table->prepare_for_position() to allow us to tell handler that it
  needs to read primary key parts to be able to store them in
  future table->position() calls.
  (This replaces the table->file->ha_retrieve_all_pk function)

- table->mark_auto_increment_column() to tell handler are going to update
  columns part of any auto_increment key.

- table->mark_columns_used_by_index() to mark all columns that is part of
  an index.  It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
  it to quickly know that it only needs to read colums that are part
  of the key.  (The handler can also use the column map for detecting this,
  but simpler/faster handler can just monitor the extra() call).

- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
  also mark all columns that is used by the given key.

- table->restore_column_maps_after_mark_index() to restore to default
  column maps after a call to table->mark_columns_used_by_index().

- New item function register_field_in_read_map(), for marking used columns
  in table->read_map. Used by filesort() to mark all used columns

- Maintain in TABLE->merge_keys set of all keys that are used in query.
  (Simplices some optimization loops)

- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
  but the field in the clustered key is not assumed to be part of all index.
  (used in opt_range.cc for faster loops)

-  dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
   tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
   mark all columns as usable.  The 'dbug_' version is primarily intended
   inside a handler when it wants to just call Field:store() & Field::val()
   functions, but don't need the column maps set for any other usage.
   (ie:: bitmap_is_set() is never called)

- We can't use compare_records() to skip updates for handlers that returns
  a partial column set and the read_set doesn't cover all columns in the
  write set. The reason for this is that if we have a column marked only for
  write we can't in the MySQL level know if the value changed or not.
  The reason this worked before was that MySQL marked all to be written
  columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
  bug'.

- open_table_from_share() does not anymore setup temporary MEM_ROOT
  object as a thread specific variable for the handler. Instead we
  send the to-be-used MEMROOT to get_new_handler().
  (Simpler, faster code)



Bugs fixed:

- Column marking was not done correctly in a lot of cases.
  (ALTER TABLE, when using triggers, auto_increment fields etc)
  (Could potentially result in wrong values inserted in table handlers
  relying on that the old column maps or field->set_query_id was correct)
  Especially when it comes to triggers, there may be cases where the
  old code would cause lost/wrong values for NDB and/or InnoDB tables.

- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
  OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
  This allowed me to remove some wrong warnings about:
  "Some non-transactional changed tables couldn't be rolled back"

- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
  (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
  some warnings about
  "Some non-transactional changed tables couldn't be rolled back")

- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
  which could cause delete_table to report random failures.

- Fixed core dumps for some tests when running with --debug

- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
  (This has probably caused us to not properly remove temporary files after
  crash)

- slow_logs was not properly initialized, which could maybe cause
  extra/lost entries in slow log.

- If we get an duplicate row on insert, change column map to read and
  write all columns while retrying the operation. This is required by
  the definition of REPLACE and also ensures that fields that are only
  part of UPDATE are properly handled.  This fixed a bug in NDB and
  REPLACE where REPLACE wrongly copied some column values from the replaced
  row.

- For table handler that doesn't support NULL in keys, we would give an error
  when creating a primary key with NULL fields, even after the fields has been
  automaticly converted to NOT NULL.

- Creating a primary key on a SPATIAL key, would fail if field was not
  declared as NOT NULL.


Cleanups:

- Removed not used condition argument to setup_tables

- Removed not needed item function reset_query_id_processor().

- Field->add_index is removed. Now this is instead maintained in
  (field->flags & FIELD_IN_ADD_INDEX)

- Field->fieldnr is removed (use field->field_index instead)

- New argument to filesort() to indicate that it should return a set of
  row pointers (not used columns). This allowed me to remove some references
  to sql_command in filesort and should also enable us to return column
  results in some cases where we couldn't before.

- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
  bitmap, which allowed me to use bitmap functions instead of looping over
  all fields to create some needed bitmaps. (Faster and smaller code)

- Broke up found too long lines

- Moved some variable declaration at start of function for better code
  readability.

- Removed some not used arguments from functions.
  (setup_fields(), mysql_prepare_insert_check_table())

- setup_fields() now takes an enum instead of an int for marking columns
   usage.

- For internal temporary tables, use handler::write_row(),
  handler::delete_row() and handler::update_row() instead of
  handler::ha_xxxx() for faster execution.

- Changed some constants to enum's and define's.

- Using separate column read and write sets allows for easier checking
  of timestamp field was set by statement.

- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()

- Don't build table->normalized_path as this is now identical to table->path
  (after bar's fixes to convert filenames)

- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
  do comparision with the 'convert-dbug-for-diff' tool.


Things left to do in 5.1:

- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
  row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
  Mats has promised to look into this.

- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
  (I added several test cases for this, but in this case it's better that
  someone else also tests this throughly).
  Lars has promosed to do this.
2006-06-04 18:52:22 +03:00
jimw@mysql.com
8262c3c38e Merge mysql.com:/home/jimw/my/mysql-5.0-clean
into  mysql.com:/home/jimw/my/mysql-5.1-clean
2006-05-19 19:07:33 -07:00
knielsen@mysql.com
a061c90d8a Merge mysql.com:/usr/local/mysql/tmp_merge
into  mysql.com:/usr/local/mysql/merge-5.1
2006-05-18 11:56:50 +02: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
knielsen@mysql.com
c8fd62f3b2 After-merge fixes; some function signatures changed from Item * to Item **. 2006-05-15 19:57:10 +02:00
konstantin@mysql.com
85c6883146 Merge mysql.com:/opt/local/work/mysql-5.0-root
into  mysql.com:/opt/local/work/mysql-5.0-runtime-merge
2006-05-15 00:51:12 +04:00
kroki@mysql.com
0963c705cd Bug#14635: Accept NEW.x as INOUT parameters to stored procedures
from within triggers

Add support for passing NEW.x as INOUT and OUT parameters to stored
procedures.  Passing NEW.x as INOUT parameter requires SELECT and
UPDATE privileges on that column, and passing it as OUT parameter
requires only UPDATE privilege.
2006-05-12 13:55:21 +04:00
anozdrin@mysql.com
65b87b86a3 Fix for BUG#18587: Function that accepts and returns TEXT
garbles data if longer than 766 chars.

The problem is that a stored routine returns BLOBs to the previous
caller, BLOBs are shallow-copied (i.e. only pointers to the data are
copied). The fix is to also copy data of BLOBs.
2006-05-10 23:16:30 +04:00
jani@ua141d10.elisa.omakaista.fi
083f8455c7 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-new
2006-05-09 20:50:29 +03:00
msvensson@neptunus.(none)
2759603c1d Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0
2006-05-09 10:44:19 +02:00
aelkin@mysql.com
899cf9b584 Merge mysql.com:/usr_rh9/home/elkin.rh9/4.1
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/5.0-bug19136
2006-05-07 16:02:55 +03:00
aelkin@mysql.com
7dcd1383a8 Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/4.1
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/FIXES/4.1-bug19136_unass_user_var
2006-05-07 11:43:27 +03:00
kroki@mysql.com
0acef25de8 Merge mysql.com:/home/tomash/src/mysql_ab/tmp_merge
into  mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-merge
2006-05-06 11:18:42 +04:00
aelkin@mysql.com
8c57924a6a Bug#19136: Crashing log-bin and uninitialized user variables in a derived table
The reason of the bug is in that `get_var_with_binlog' performs missed
assingment of
the variables as side-effect. Doing that it eventually calls
`free_underlaid_joins' to pass as an argument `thd->lex->select_lex' of the lex
which belongs to the user query, not 
to one which is emulated i.e SET @var1:=NULL.


`get_var_with_binlog' is refined to supply a temporary lex to sql_set_variables's stack.
2006-05-05 11:21:21 +03:00
jimw@mysql.com
3f239914d7 Merge mysql.com:/home/jimw/my/tmp_merge
into  mysql.com:/home/jimw/my/mysql-5.1-clean
2006-04-30 09:43:26 -07:00
msvensson@shellback.(none)
53b842866e Fix small bug in udf_example.cc, it was processing one char too much and thus returning junk
Add more DBUG_PRINT's in udf_handler::val_str
Enable udf.test
2006-04-28 11:37:20 +02:00
jimw@mysql.com
ca2b14e7b4 Merge mysql.com:/home/jimw/my/mysql-5.0-12792
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2006-04-26 11:39:48 -07:00
pem@mysql.com
0e2d20b1cb Merge mysql.com:/extern/mysql/5.1/generic/mysql-5.0-merge
into  mysql.com:/extern/mysql/5.1/generic/mysql-5.1-new
2006-04-25 16:20:49 +02:00
kroki@mysql.com
c77336c260 Bug#16501: IS_USED_LOCK does not appear to work
Update User_level_lock::thread_id on acquiring an existing lock,
and reset it on lock release.
2006-04-24 18:06:43 +04:00
bell@sanja.is.com.ua
b2c810e847 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-merge-5.1
2006-04-24 13:32:07 +03:00
konstantin@mysql.com
ba845055f9 Merge mysql.com:/opt/local/work/tmp_merge
into  mysql.com:/opt/local/work/mysql-5.1-merge
2006-04-23 04:04:36 +04:00
jimw@mysql.com
ec00b92f48 Bug #12792: @@system_time_zone is not SELECTable
Bug #15684: @@version_* are not all SELECTable

  Added the appropriate information as read-only system variables, and
  also removed some special-case handling of @@version along the way.

  @@version_bdb was added, but isn't included in the test because it
  depends on the presence of BDB.
2006-04-20 21:56:53 -07:00
dlenev@mysql.com
19e558a09d Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mysql.com:/home/dlenev/mysql-5.0-bg16021
2006-04-19 19:35:32 +04:00