Commit graph

494 commits

Author SHA1 Message Date
holyfoot/hf@deer.(none)
dd0b81885d Merge mysql.com:/home/hf/work/mysql-5.0-mrg
into  mysql.com:/home/hf/work/mysql-5.1-mrg
2006-11-17 18:27:28 +04:00
holyfoot/hf@mysql.com/deer.(none)
950665fc3b merging 2006-11-17 11:15:40 +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
holyfoot/hf@mysql.com/deer.(none)
497ccd6b87 Merge mysql.com:/home/hf/work/mysql-4.1-mrg
into  mysql.com:/home/hf/work/mysql-5.0-mrg
2006-11-16 23:16:44 +04: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
gkodinov/kgeorge@macbook.gmz
299a0fe65d Merge macbook.gmz:/Users/kgeorge/mysql/work/B11032-4.1-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B11032-5.0-opt
2006-11-07 18:44:37 +02:00
gkodinov/kgeorge@macbook.gmz
cf1ca923fc Bug #11032: getObject() returns a String for a sub-query of type datetime
- When returning metadata for scalar subqueries the actual type of the
   column was calculated based on the value type, which limits the actual
   type of a scalar subselect to the set of (currently) 3 basic types : 
   integer, double precision or string. This is the reason that columns
   of types other then the basic ones (e.g. date/time) are reported as
   being of the corresponding basic type.
   Fixed by storing/returning information for the column type in addition
   to the result type.
2006-11-07 18:16:17 +02:00
sergefp@mysql.com
e59f19177e BUG#8804: Incorrect results for NULL IN (SELECT ...): review fixes:
- Better comments
- Remove redundant and dead code.
2006-11-01 00:27:51 +03:00
sergefp@mysql.com
cc05fbd7b0 BUG#8804: Better comment + TODO section with suggestion how to speedup
the fix.
2006-10-31 21:30:40 +03:00
sergefp@mysql.com
54a713aac5 BUG#8804: wrong results for NULL IN (SELECT ...)
Evaluate "NULL IN (SELECT ...)" in a special way: Disable pushed-down 
conditions and their "consequences": 
 = Do full table scans instead of unique_[index_subquery] lookups.
 = Change appropriate "ref_or_null" accesses to full table scans in
   subquery's joins.
Also cache value of NULL IN (SELECT ...) if the SELECT is not correlated 
wrt any upper select.
2006-10-31 20:51:09 +03:00
igor@rurik.mysql.com
d8a8369454 Adjustments after the merge for bug 23478. 2006-10-20 12:41:27 -07:00
igor@rurik.mysql.com
c6663c32db Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
into  rurik.mysql.com:/home/igor/mysql-5.0-opt
2006-10-20 09:26:01 -07:00
igor@rurik.mysql.com
d8b6f46a39 Fixed bug #23478.
If elements a not top-level IN subquery were accessed by an index and 
the subquery result set included  a NULL value then the quantified
predicate that contained the subquery was evaluated to NULL when 
it should return a non-null value.
2006-10-19 23:05:53 -07:00
jimw@rama.(none)
caf4392f71 Merge bk-internal:/home/bk/mysql-4.1-maint
into  rama.(none):/home/jimw/my/mysql-4.1-clean
2006-09-28 18:11:29 -07: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
sergefp@mysql.com
84e9cb794f BUG#16255: Merge to 5.0 2006-08-24 20:56:28 +04:00
sergefp@mysql.com
d4cacdb5cc Bug #16255: Subquery in WHERE (the cset by Georgi Kodinov)
Must not use Item_direct_ref in HAVING because it points to
 the new value (witch is not yet calculated for the first row).
2006-08-24 19:14:36 +04:00
jimw@rama.(none)
cb6a084076 Bug #2717: include/my_global.h mis-defines __attribute__
Fix when __attribute__() is stubbed out, add ATTRIBUTE_FORMAT() for specifying
  __attribute__((format(...))) safely, make more use of the format attribute,
  and fix some of the warnings that this turns up (plus a bonus unrelated one).
2006-08-17 12:25:40 -07: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
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
msvensson@neptunus.(none)
31be565d2e Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-08-01 20:24:30 +02: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
sergefp@mysql.com
305788527e Post-merge fixes 2006-07-22 16:18:28 +04:00
sergefp@mysql.com
9024ed81c7 Merge mysql.com:/home/psergey/mysql-4.1-opt
into  mysql.com:/home/psergey/mysql-5.0-opt
2006-07-21 23:45:34 +04:00
sergefp@mysql.com
bffd438de3 BUG#20975: Incorrect query result for NOT (subquery):
Add implementations of Item_func_{nop,not}_all::neg_transformer
2006-07-21 03:04:04 +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
evgen@moonbone.local
4b1730241d Merge moonbone.local:/work/16302-bug-4.1-opt-mysql
into  moonbone.local:/work/tmp_merge-5.0-opt-mysql
2006-07-13 18:18:20 +04:00
evgen@moonbone.local
d34189715e Fixed bug#16302: Quantified subquery without any tables gives wrong results
The ALL/ANY subqueries are the subject of MIN/MAX optimization. The matter
of this optimization is to embed MIN() or MAX() function into the subquery
in order to get only one row by which we can tell whether the expression
with ALL/ANY subquery is true or false.
But when it is applied to a subquery like 'select a_constant' the reported bug
occurs. As no tables are specified in the subquery the do_select() function 
isn't called for the optimized subquery and thus no values have been added 
to a MIN()/MAX() function and it returns NULL instead of a_constant.
This leads to a wrong query result.

For the subquery like 'select a_constant' there is no reason to apply
MIN/MAX optimization because the subquery anyway will return at most one row.
Thus the Item_maxmin_subselect class is more appropriate for handling such
subqueries.

The Item_in_subselect::single_value_transformer() function now checks
whether tables are specified for the subquery. If no then this subselect is
handled like a UNION using an Item_maxmin_subselect object.
2006-07-11 00:34:37 +04: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
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
jani@a193-229-222-105.elisa-laajakaista.fi
c81b4c01bf Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0
into  a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-new
2006-05-30 16:07:49 +03:00
gkodinov@mysql.com
d6b5a89044 Bug #19700: subselect returning BIGINT always returned it as SIGNED
The unsigned flag in Item was not propagated through the single value subqueries.
This caused the result to be treated as signed.
2006-05-25 10:39:18 +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
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
gkodinov@mysql.com
9f9a76eb6e Merge mysql.com:/home/kgeorge/mysql/5.0/tmp_merge
into  mysql.com:/home/kgeorge/mysql/5.1/merge
2006-05-17 13:29:20 +03: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
jimw@mysql.com
f21c110d13 Merge mysql.com:/home/jimw/my/mysql-5.0-clean
into  mysql.com:/home/jimw/my/mysql-5.1-clean
2006-04-30 13:27:38 -07:00
gkodinov@lsmy3.wdf.sap.corp
6e5cf86f4d Merge lsmy3.wdf.sap.corp:/data/users/gkodinov/mysql-4.1-B18492
into  lsmy3.wdf.sap.corp:/data/users/gkodinov/mysql-5.0-B18492
2006-04-28 12:06:54 +02:00
gkodinov@lsmy3.wdf.sap.corp
ca79343359 BUG#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol
In the code that converts IN predicates to EXISTS predicates it is changing
the select list elements to constant 1. Example :
SELECT ... FROM ...  WHERE a IN (SELECT c FROM ...)
is transformed to :
SELECT ... FROM ... WHERE EXISTS (SELECT 1 FROM ...  HAVING a = c)
However there can be no FROM clause in the IN subquery and it may not be
a simple select : SELECT ... FROM ... WHERE a IN (SELECT f(..) AS
c UNION SELECT ...) This query is transformed to : SELECT ... FROM ...
WHERE EXISTS (SELECT 1 FROM (SELECT f(..) AS c UNION SELECT ...)
x HAVING a = c) In the above query c in the HAVING clause is made to be
an Item_null_helper (a subclass of Item_ref) pointing to the real
Item_field (which is not referenced anywhere else in the query anymore).
This is done because Item_ref_null_helper collects information whether
there are NULL values in the result.  This is OK for directly executed
statements, because the Item_field pointed by the Item_null_helper is
already fixed when the transformation is done.  But when executed as
a prepared statement all the Item instances are "un-fixed" before the
recompilation of the prepared statement. So when the Item_null_helper
gets fixed it discovers that the Item_field it points to is not fixed
and issues an error.  The remedy is to keep the original select list
references when there are no tables in the FROM clause. So the above
becomes : SELECT ... FROM ...  WHERE EXISTS (SELECT c FROM (SELECT f(..)
AS c UNION SELECT ...) x HAVING a = c) In this way c is referenced
directly in the select list as well as by reference in the HAVING
clause. So it gets correctly fixed even with prepared statements.  And
since the Item_null_helper subclass of Item_ref_null_helper is not used
anywhere else it's taken out.
2006-04-28 11:23:31 +02:00
jimw@mysql.com
00d29cd259 Merge mysql.com:/home/jimw/my/mysql-5.0-clean
into  mysql.com:/home/jimw/my/mysql-5.1-clean
2005-12-12 11:57:07 -08:00
monty@mysql.com
4575a662cb Merge mysql.com:/home/my/mysql-5.1
into  mysql.com:/home/my/mysql-5.1-TDC
2005-11-23 22:58:53 +02:00
monty@mysql.com
e42c980967 Table definition cache, part 2
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
  object and open a handler to the table object

Other noteworthy changes:
- In TABLE_SHARE the most common strings are now LEX_STRING's
- Better error message when table is not found
- Variable table_cache is now renamed 'table_open_cache'
- New variable 'table_definition_cache' that is the number of table defintions that will be cached
- strxnmov() calls are now fixed to avoid overflows
- strxnmov() will now always add one end \0 to result
- engine objects are now created with a TABLE_SHARE object instead of a TABLE object.
- After creating a field object one must call field->init(table) before using it

- For a busy system this change will give you:
 - Less memory usage for table object
 - Faster opening of tables (if it's has been in use or is in table definition cache)
 - Allow you to cache many table definitions objects
 - Faster drop of table
2005-11-23 22:45:02 +02:00
jani@a193-229-222-105.elisa-laajakaista.fi
5273071265 Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0
into  a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-new
2005-11-23 14:57:00 +02:00
igor@rurik.mysql.com
7b1b69a6e7 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2
2005-11-22 23:00:57 -08:00
bell@sanja.is.com.ua
806f9e24ff Inefficient usage of String::append() fixed.
Bad examples of usage of a string with its length fixed.
The incorrect length in the trigger file configuration descriptor
  fixed (BUG#14090).
A hook for unknown keys added to the parser to support old .TRG files.
2005-11-20 20:47:07 +02:00
monty@mysql.com
a6f5375cb0 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
2005-11-05 01:32:55 +02:00
igor@rurik.mysql.com
c136e9c43b Fixed bug #12762:
allowed set functions aggregated in outer subqueries, allowed nested set functions.
2005-10-15 14:32:37 -07:00
konstantin@mysql.com
b2ff38202d A fix and a test case for Bug#12736 "Server crash during a select".
The bug was in JOIN::join_free which was wrongly determining that
all joins have been already executed and therefore all used tables
can be closed.
2005-10-13 11:53:00 +04:00
tomas@poseidon.ndb.mysql.com
620b7bafb0 Merge 2005-10-06 10:54:07 +02:00
konstantin@mysql.com
6f8d3c4844 A fix and a test case for Bug#6513 "Test Suite: Values inserted by using
cursor is interpreted latin1 character and Bug#9819 "Cursors: Mysql Server
Crash while fetching from table with 5 million records."
A fix for a possible memory leak when fetching into an SP cursor
in a long loop.
The patch uses a common implementation of cursors in the binary protocol and 
in stored procedures and implements materialized cursors.
For implementation details, see comments in sql_cursor.cc
2005-09-22 02:11:21 +04:00
ndbdev@dl145c.mysql.com
f40c1576b0 Merge 2005-09-06 09:20:15 +02:00
konstantin@mysql.com
a3ddcdf8fb Rename:
- current_arena to stmt_arena: the thread may have more than one
'current' arenas: one for runtime data, and one for the parsed 
tree of a statement. Only one of them is active at any moment.
- set_item_arena -> set_query_arena, because Item_arena was renamed to 
Query_arena a while ago
- set_n_backup_item_arena -> set_n_backup_active_arena;
the active arena is the arena thd->mem_root and thd->free_list
are currently pointing at.
- restore_backup_item_arena -> restore_active_arena (with the same
rationale)
- change_arena_if_needed -> activate_stmt_arena_if_needed; this
method sets thd->stmt_arena active if it's not done yet.
2005-09-02 17:21:19 +04:00
pappa@c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se
02056f8e3a Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.0
into  c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-5.1
2005-08-25 13:11:38 -04:00
sanja@hasky.mysql.fi
2e2b897ff3 item_subselect.cc:
postmerge fix
subselect.result:
  new 5.0 result (postmerge)
2005-08-13 11:15:17 +03:00
sanja@hasky.mysql.fi
16d279bb12 Merge abelkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into  hasky.mysql.fi:/home/sanja/work-merge-5.0
2005-08-13 08:19:34 +03:00
bell@50.0.168.192.in-addr.arpa
1e248ceaf1 fixed convertion and handling IN subqueries with rows (BUG#11867) 2005-08-13 07:45:14 +03:00
dlenev@mysql.com
0f75d64734 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/dlenev/src/mysql-5.0-bg11973-2
2005-08-11 10:39:33 +04:00
dlenev@mysql.com
60511c3df2 Clumsy but working fix for bug #11973 "SELECT .. INTO var_name; in trigger
cause crash on update".

Let us update "thd" pointer in LEX, all its units and in LEX::result before
executing statement in trigger body, since triggers are associated with TABLE
object and because of this can be used in different threads.
2005-08-10 00:23:56 +04:00
igor@rurik.mysql.com
c6d1a05aa0 Manual merge 2005-08-07 15:10:06 -07:00
igor@rurik.mysql.com
b2a189ab07 subselect.result:
Added test case for bug #11867.
  Fixed results for two existing test cases.
subselect.test:
  Added test case for bug #11867.
item_subselect.cc:
  Fixed bug #11867.
  Added missing code in Item_in_subselect::row_value_transformer
  that caused problems for queries with
  ROW(elems) IN (SELECT DISTINCT cols FROM ...).
2005-08-07 14:03:46 -07:00
mronstrom@mysql.com
67087e2aa7 Patch for push of wl1354 Partitioning 2005-07-18 13:31:02 +02:00
bell@sanja.is.com.ua
d3905f3d0e Name resolution context added (BUG#6443) 2005-07-01 07:05:42 +03:00
konstantin@mysql.com
8b0cee88f0 A fix and a test case for Bug#10736 "mysql_stmt_attr_set
CURSOR_TYPE_READ_ONLY select within select".
The bug was caused by the reset of thd->mem_root to thd->main_mem_root in 
Item_subselect::exec, which in turn triggered too early free_root() for
data which was needed on subsequent fetches from a cursor.
This reset also caused a memory leak in stored procedures, as 
subsequent executions of instructions containing a subselect
were allocating memory in thd->main_mem_root, which is not freed
until the end of the entire SP, instead of the per-call mem_root,
which is freed in the end of execution of the instruction.
2005-06-28 20:52:15 +04:00
igor@rurik.mysql.com
268110b34b Manual merge 2005-06-23 11:22:30 -07:00
igor@rurik.mysql.com
c73c2af614 func_str.result, func_str.test:
Added a test case for bug #10124.
sql_select.h, item_subselect.cc, sql_select.cc:
  Fixed bug #10124.
  The copy method of the store_key classes can return
  STORE_KEY_OK=0, STORE_KEY_FATAL=1, STORE_KEY_CONV=2 now.
field.cc:
  Fixed bug #10124.
  When ussuing a warning the store methods return 2 instead of 1 now.
2005-06-23 06:15:50 -07:00
serg@serg.mylan
01b3c70926 renamed:
Item_buff -> Cached_item
  Item_arena -> Query_arena
  TEST_ASSERT -> YYERROR_UNLESS
2005-06-15 19:58:35 +02:00
ramil@mysql.com
6f8ef49895 A fix (bug #11153: Ambiguous call to overloaded function, acording to Visual Studio 6) 2005-06-08 11:37:43 +05:00
konstantin@mysql.com
ac2a9eb699 Manual merge. 2005-06-07 14:50:45 +04:00
konstantin@mysql.com
9f379d7f05 Patch two (the final one) for Bug#7306 "the server side preparedStatement
error for LIMIT placeholder".
The patch adds grammar support for LIMIT ?, ? and changes the
type of ST_SELECT_LEX::select_limit,offset_limit from ha_rows to Item*,
so that it can point to Item_param.
2005-06-07 14:11:36 +04:00
monty@mysql.com
775f17667b Merge with 4.1 2005-06-07 00:31:53 +03:00
serg@serg.mylan
6a5349028c a compiler must see '#pragma implementation' *before*
'#pragma interface' (that comes with the #include'd header file)
2005-06-05 19:38:52 +02:00
monty@mysql.com
4b7882dc73 merge 2005-06-05 17:19:50 +03:00
monty@mysql.com
29fd1f2fd9 Move USE_PRAGMA_IMPLEMENTATION to proper place
Ensure that 'null_value' is not accessed before val() is called in FIELD() functions
Fixed initialization of key maps. This fixes some problems with keys when you have more than 64 keys
Fixed that ROLLUP don't always create a temporary table. This fix ensures that func_gconcat.test results are now predictable
2005-06-03 23:46:03 +03:00
konstantin@mysql.com
123bcb9d8d Give Item_arena::is_stmt_prepare a more descriptive name (it marks
the code that is active for SP as well in 5.0)
2005-06-03 00:02:47 +04:00
brian@zim.(none)
113a99626d Merge of 4.1->5.0. This contained the fixes for GCC 4.0 2005-06-01 21:56:30 -07:00
brian@zim.(none)
efb5ed5bab Merge 2005-06-01 18:48:29 -07:00
kent@mysql.com
bd48eed988 tztime.cc:
Set #pragma implementation" earlier
Many files:
  Need to include <my_global.h> before #ifdef USE_PRAGMA_IMPLEMENTATION
2005-06-02 02:43:32 +02:00
brian@zim.(none)
ba9b9f8993 Mainly cleanups for gcc 4.0. Some small pieces from looking at -Wall. Removed a number of dumb things in ha_tina. 2005-06-01 17:34:10 -07:00
monty@mysql.com
a69f432115 Code cleanups during code reviews
Ensure we get error if INSERT IGNORE ... SELECT fails
Fixed wrong key_part->key_length usage in index_merge
2005-06-01 16:35:09 +03:00
monty@mysql.com
e253b7815a Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
2005-05-31 15:22:44 +03:00
pem@mysql.com
53abbdc39b Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
2005-05-31 12:07:16 +02:00
pem@mysql.comhem.se
063896a6e7 Post-review fixes of BUG#9937: Crash on call to stored procedure. 2005-05-31 12:06:15 +02:00
monty@mysql.com
bfcf3c6ac9 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
2005-05-31 12:29:24 +03:00
monty@mysql.com
7538ce70d5 Fixed bug in multiple-table-delete where some rows was not deleted 2005-05-30 20:48:40 +03:00
konstantin@mysql.com
e315f903d0 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/opt/local/work/mysql-5.0-7306-new
2005-05-30 20:56:11 +04:00
konstantin@mysql.com
2d6a70c42a Preparatory (and the most problematic) patch for Bug#7306
"the server side preparedStatement error for LIMIT placeholder",
which moves all uses of LIMIT clause from PREPARE to OPTIMIZE
and later steps.
After-review fixes.
2005-05-30 20:54:37 +04:00
pem@mysql.com
e496b24304 Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
2005-05-30 11:06:31 +02:00
msvensson@neptunus.(none)
697cfe7f07 Merge from 4.1 2005-05-26 21:01:55 +02:00
pem@mysql.comhem.se
3eca4bf22e Fixed BUG#9937: Crash on call to stored procedure.
This only showed up on two known platforms, both ia64 (one HP-UX and one Linux wich icc).
For some reason, they only get half the stack size they are supposed to have, which
makes deep SP recursion overrun the stack before check_stack_overrun() is triggered.
Also made som minor fixes in the check_stack_overrun() definition, supporting variable
margins.
No test case added, but the reason for the bug report was a failed existing test case
on these machines, which now works.
2005-05-26 20:36:14 +02:00
msvensson@neptunus.(none)
83d430353e Add ifdefs to control when "#pragma implementation" should be used
Added some more ifdefs for "#pragma interface"
2005-05-26 12:09:14 +02:00
bell@sanja.is.com.ua
1029e533df postmerge 4.1->5.0 fixes 2005-04-01 02:14:30 +03:00
bell@sanja.is.com.ua
05d4ed14e4 merge 4.1->5.0 2005-03-31 10:39:48 +03:00
bell@sanja.is.com.ua
4fdb0f48e7 postreview changes
fixed bug in IN/ALL/ANY subqeries with HAVING clause (BUG#9350)
2005-03-30 10:07:08 +03:00
bell@sanja.is.com.ua
4554b1f263 fixed union types merging and table related metadata (BUG#8824) 2005-03-23 08:36:48 +02:00
jimw@mysql.com
ee2b4ec959 Eliminate warnings noticed by VC7. This includes fixing my_mmap() on
Windows to call CreateFileMapping() with correct arguments, and
propogating the introduction of query_id_t to everywhere query ids are
passed around. (Bug #8826)
2005-03-18 16:12:25 -08:00
bell@sanja.is.com.ua
056d5a3934 fixed left expression of IN/ALL/ANY subquery transformation support (BUG#8888) 2005-03-10 14:01:22 +02:00
monty@mysql.com
0a6b7aedb2 Remove compiler warnings and remove not used variables
(Found during build process)
2005-02-25 16:53:22 +02:00
monty@mysql.com
a1a39fab84 Merge with 4.1 2005-02-10 02:27:37 +02:00
bell@sanja.is.com.ua
90c0024217 reverted patch for BUG#7351 (because of performance ussie) 2005-02-09 21:08:08 +02:00
hf@deer.(none)
b94a482ee9 Precision Math implementation 2005-02-09 02:50:45 +04:00
monty@mysql.com
80b3e02462 Fixed bug detected by sp-tests
Cleanup during reviews of new pushed code
2005-02-05 16:05:46 +02:00
monty@mysql.com
422c2eb868 4.1 -> 5.0 merge 2005-02-03 13:18:30 +02:00
bell@sanja.is.com.ua
0bf6e3aefc fixed cleanup of result object of subqueries. (BUG#8125) 2005-01-26 15:27:45 +02:00
bell@sanja.is.com.ua
2371c992de check that row elements have the same dimention that SELECT list elements in comporison between rows and subqueries added (BUG#8022) 2005-01-24 15:56:57 +02:00
bell@sanja.is.com.ua
76ae5caca0 fixed column number fetchinmg for subqueries. (BUG#8020)
fixed cols() method call (it have to be called only after fix_fields())
2005-01-24 14:25:44 +02:00
sergefp@mysql.com
9a7a47c21c Merge mysql.com:/dbdata/psergey/mysql-4.1-bug7885
into mysql.com:/dbdata/psergey/mysql-5.0-bug7885
2005-01-19 23:11:50 +03:00
sergefp@mysql.com
b1d55200b1 Fix for BUG#7885 2005-01-18 17:26:05 +03:00
monty@mysql.com
d35140a851 First stage of table definition cache
Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon)
Created Field::make_field() and made Field_num::make_field() to call this
Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead
Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer.
Renamed TABLE_SHARE->real_name to table_name
Renamed TABLE->table_name to alias
Renamed TABLE_LIST->real_name to table_name
2005-01-06 13:00:13 +02:00
serg@sergbook.mysql.com
a04fc26c54 manually merged 2004-12-31 15:26:24 +01:00
igor@rurik.mysql.com
d3fa245363 subselect.result, subselect.test:
Added test cases for bug #7351.
item_cmpfunc.cc:
  Fixed bug #7351: incorrect result for a query with a
  subquery returning empty set.
  If in the predicate v IN (SELECT a FROM t WHERE cond)
  v is null, then the result of the predicate is either
  INKNOWN or FALSE. It is FALSE if the subquery returns
  an empty set.
item_subselect.cc:
  Fixed bug #7351: incorrect result for a query with a
  subquery returning empty set.
  The problem was due to not a quite legal transformation
  for 'IN' subqueries. A subquery containing a predicate
  of the form
  v IN (SELECT a FROM t WHERE cond)
  was transformed into
  EXISTS(SELECT a FROM t WHERE cond AND (a=v OR a IS NULL)).
  Yet, this transformation is valid only if v is not null.
  If v is null, then, in the case when
  (SELECT a FROM t WHERE cond) returns an empty set the value
  of the predicate is FALSE, otherwise the result of the
  predicate is INKNOWN.
  The fix resolves this problem by changing the result
  of the transformation to
  EXISTS(SELECT a FROM t WHERE cond AND (v IS NULL OR (a=v OR a IS NULL)))
  in the case when v is nullable.
  The new transformation prevents applying the lookup
  optimization for IN subqueries. To make it still
  applicable we have to introduce guarded access methods.
2004-12-25 19:17:57 -08:00
monty@mishka.local
4f4bbfc279 Merge with 4.1 2004-12-22 13:54:39 +02:00
sergefp@mysql.com
3c8f48d2e3 * Added comments and one assert
* Backport of safety measures from 5.0: make numeorous replaces:
    s/item->fix_fields()/if (!item->fixed) item->fix_fields()
2004-12-14 03:36:19 +03:00
bell@sanja.is.com.ua
b9abf25a55 new reference which refer to current value not to result used for resolving outer
refernces if subqueri is not in HAVING clause (BUG#7079)
  and the same used for subquery transformetion
2004-12-11 17:13:19 +02:00
konstantin@mysql.com
356005efd7 A fix and test case for Bug#6873 "PS, having with subquery, crash
during execute"
2004-12-09 00:37:17 +03:00
bell@sanja.is.com.ua
acbca25dd2 postreview fix 2004-12-07 21:18:15 +02:00
bell@sanja.is.com.ua
072d38eb12 merge 2004-11-21 20:08:12 +02:00
bell@sanja.is.com.ua
f5e253dc2f reporting empty result added in case of max/min optimisation of ALL/ANY/SOME subqueries
fixed null processing in NOT operation used in ALL subquery (Bug #6247)
2004-11-18 18:10:07 +02:00
bell@sanja.is.com.ua
1555469b64 merge 2004-11-12 15:36:31 +02:00
bell@sanja.is.com.ua
31f7811183 post-review fixes 2004-11-12 14:34:00 +02:00
bell@sanja.is.com.ua
0ef0b030a5 merge 2004-11-11 21:18:10 +02:00
konstantin@mysql.com
e5f4c7a0bd Rename: Item::val -> Item::val_real(). 2004-11-11 21:39:35 +03:00
monty@mysql.com
1087186657 Merge with 4.1 to get new thd->mem_root handling 2004-11-08 17:53:32 +02:00
monty@mysql.com
b903a129e2 Simpler arena swapping code
Now thd->mem_root is a pointer to thd->main_mem_root and THR_MALLOC is a pointer to thd->mem_root.
This gives us the following benefits:
- Allow us to easily detect if arena has already been swapped before (this fixes a bug in setup_conds() where arena was swaped twice in some cases)
- Faster swaps of arenas (as we don't have to copy the whole MEM_ROOT)
- We don't anymore have to call my_pthread_setspecific_ptr(THR_MALLOC,...) to change where memory is alloced. Now it's enough to set thd->mem_root
2004-11-08 01:13:54 +02:00
monty@mysql.com
afbe601302 merge with 4.1 2004-10-29 19:26:52 +03:00
bell@sanja.is.com.ua
3ae044c24f removed incorrect error message about aggregate functions
improved mechanisn of detection posibility to be NULL for single row queries
switched off substitution optimisation for single row subqueries in PS due to problem in resolving substituted expressions
(changes to make subselects test working with PS protocol)
2004-10-27 21:11:06 +03:00
monty@mysql.com
6fbc869d18 A lot of fixes for prepared statements (PS):
New mysqltest that can run mysqltest with PS
Added support for ZEROFILL in PS
Fixed crash when one called mysql_stmt_store_result() without a preceding mysql_stmt_bind_result()
Updated test cases to support --ps-protocol
(Some tests are still run using old protocol)
Fixed crash in PS when using SELECT * FROM t1 NATURAL JOIN t2...
Fixed crash in PS when using sub queries
Create table didn't signal when table was created. This could cause a "DROP TABLE created_table" in another thread to wait "forever"
Fixed wrong permissions check in PS and multi-table updates (one could get permission denied for legal quries)
Fix for PS and SELECT ... PROCEDURE
Reset all warnings when executing a new PS query
group_concat(...ORDER BY) didn't work with PS
Fixed problem with test suite when not using innodb
2004-10-26 19:30:01 +03:00
bell@sanja.is.com.ua
4714a6e744 errors without code removed
net_printf/send_error calls replaced by my_error family functions
-1/1 (sent/unsent) error reporting removed
(WL#2133)
2004-10-20 04:04:37 +03:00
bell@sanja.is.com.ua
8db65bd6ae Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
2004-10-13 23:25:36 +03:00
konstantin@mysql.com
234c80b689 Deployment of centralized Item change registry, step 2: Item_ref
doesn't need to have it's own recovery mechanism.
2004-10-08 19:13:09 +04:00
bell@sanja.is.com.ua
df43a27a96 correct (high level) fix for BUG#5367 to privent problems in other engines 2004-10-07 14:13:42 +03:00
konstantin@mysql.com
e107778119 Comments to the single-select optimization algorithm. 2004-10-04 18:58:06 +04:00
bell@sanja.is.com.ua
f11bcefae1 fixed error handling if creating derived table failed
single row subquery always can return NULL (no rows found) (BUG#5590)
2004-09-17 19:08:46 +03:00
bell@sanja.is.com.ua
f797298fc5 fixed merged view fields names (BUG#5147)
support of merged VIEW over several tables added (WL#1809)
2004-09-14 19:28:29 +03:00
bell@sanja.is.com.ua
a7de21c3e0 thd pointer fixed 2004-09-10 13:09:27 +03:00
bell@sanja.is.com.ua
a23857e071 post merge fixes 2004-09-10 02:22:44 +03:00
monty@mysql.com
f2829d0386 After merge fixes of merge with 4.1 that included the new arena code.
Fixed (together with Guilhem) bugs in mysqlbinlog regarding --offset
Prefix addresses with 0x for easier comparisons of debug logs
Fixed problem where MySQL choosed index-read even if there would be a much better range on the same index
This fix changed some 'index' queries to 'range' queries in the test suite
Don't create 'dummy' WHERE clause for trivial WHERE clauses where we can remove the WHERE clause.
This fix removed of a lot of 'Using where' notes in the test suite.
Give NOTE instead of WARNING if table/function doesn't exists when using DROP IF EXISTS
Give NOTE instead of WARNING for safe field-type conversions
2004-09-09 06:59:26 +03:00
monty@mysql.com
31122efde7 Merge with 4.1
(Includes merge of arena code in 4.1 and 5.0)
2004-09-06 15:14:10 +03:00
bell@sanja.is.com.ua
5d42c492d6 fixed temporary table processing expresions of subqueries and removed wrong restrictions of field resolving (BUG#5326) 2004-09-06 13:00:24 +03:00
monty@mysql.com
46ff90738b Merge with pulled code 2004-09-03 22:38:45 +03:00
monty@mysql.com
cbd67f49e1 Cleanup of new code pushed into 5.0 since last pull
Merged the different find_xxxx_table_in_list functions to one + some inline functions
2004-09-03 21:43:04 +03:00
bell@sanja.is.com.ua
6fcd27e9cd after review fixes:
allowed parsing of table fields inside aggregate functions
 added new tests of fields resolving in grouping
2004-08-23 22:31:01 +03:00
bell@sanja.is.com.ua
3ca433e332 merge 2004-08-23 15:50:59 +03:00
konstantin@mysql.com
568c6e8526 Fix for bug#4912 "mysqld crashs in case a statement is executed
a second time". The bug was caused by incompatibility of
negations elimination algorithm and PS: during first statement 
execute a subtree with negation was replaced with equivalent 
subtree without NOTs.
The problem was that although this transformation was permanent, 
items of the new subtree were created in execute-local memory.
The patch adds means to check if it is the first execute of a
prepared statement, and if this is the case, to allocate items
in memory of the prepared statement.
The implementation:
- backports Item_arena from 5.0
- adds Item_arena::is_stmt_prepare(), 
  Item_arena::is_first_stmt_execute().
- deletes THD::allocate_temporary_pool_for_ps_preparing(),
  THD::free_temporary_pool_for_ps_preparing(); they
  were redundant.
and adds a few invariants:
- thd->free_list never contains junk (= freed items)
- thd->current_arena is never null. If there is no
  prepared statement, it points at the thd. 
The rest of the patch contains mainly mechanical changes and
cleanups.
2004-08-21 02:02:46 +04:00
bell@sanja.is.com.ua
0ce931947e skip resolving field in table list if table list is not accessable due to groupping (BUG#4814) 2004-08-13 10:01:30 +03:00
bell@sanja.is.com.ua
d7ae5de89b in case of compound index fill all parts in optimized IN (BUG#4435) 2004-08-12 17:31:23 +03:00
serg@serg.mylan
8d080cbcfa manual merge 2004-07-20 15:34:57 +02:00
bell@sanja.is.com.ua
5eadafe569 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-subs-4.1
2004-07-17 02:13:02 +03:00
bell@sanja.is.com.ua
9336d36cf8 VIEW
two TABLE_LIST copy eliminated
2004-07-16 01:15:55 +03:00
bell@sanja.is.com.ua
3609ab683e stack overflow check added for subqueries processing (BUG#4554) 2004-07-14 23:57:14 +03:00
monty@mysql.com
1e31199995 Merge with 4.1.3-beta 2004-07-07 11:29:39 +03:00
bell@sanja.is.com.ua
130740248b aggregate functions check during substitution made only for single row subselects (BUG#4400)
restoring current senect pointer before PS rexecution (backport from 5.0)
removed spaces at  lines ends
2004-07-04 08:46:28 +03:00
bell@sanja.is.com.ua
d3efbb9d3b Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-innodb-4.1
2004-06-24 10:55:48 +03:00
bell@sanja.is.com.ua
2f5c9b7aa5 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-innodb-4.1
2004-06-23 18:58:52 +03:00
serg@serg.mylan
c03addab79 merged 2004-06-23 12:36:07 +02:00
serg@serg.mylan
3f1c4ba745 handler interface cleanups:
more logical table/index_flags
  return  HA_ERR_WRONG_COMMAND instead of abstract methods where appropriate
  max_keys and other limits renamed to max_supported_keys/etc
  max_keys/etc are now wrappers to max_supported_keys/etc 
  ha_index_init/ha_rnd_init/ha_index_end/ha_rnd_end are now wrappers to real {index,rnd}_{init,end} to enforce strict pairing
2004-06-23 12:29:05 +02:00
konstantin@mysql.com
b793142c8f Unused variables removed (many files). 2004-06-21 20:39:19 +04:00
bell@sanja.is.com.ua
98a7b49dc5 do not unlock tables early if we have subquery in HAVING clause (BUG#3984) 2004-06-09 23:32:20 +03:00
pem@mysql.com
71eddc362e Merging 4.1 to 5.0. 2004-05-26 17:04:45 +02:00
bell@sanja.is.com.ua
c7396f8d20 PS and SP made compatible in mechanism used for preparing query for rexecutions (Bug #2266) 2004-05-20 02:02:49 +03:00
bell@sanja.is.com.ua
d2fa79b291 keep old engine & JOIN if we changed subquery Item (Bug #3646) 2004-05-07 23:06:11 +03:00
pem@mysql.com
bf45960eef Merge 4.1 -> 5.0 2004-05-07 18:52:06 +02:00
magnus@neptunus.(none)
50ff8ea369 Formatting changes requested by Monty 2004-04-15 09:17:55 +02:00
pem@mysql.com
dfd59e296e Merge 4.1 -> 5.0. 2004-04-07 19:07:44 +02:00
bell@sanja.is.com.ua
9bd49d489c after review patch
commant for function
2004-03-29 22:40:49 +03:00
bell@sanja.is.com.ua
e0c2ff9df7 merge 2004-03-27 15:59:48 +02:00
bell@sanja.is.com.ua
d095d4753e after review changes 2004-03-20 13:36:26 +02:00
bell@sanja.is.com.ua
2b45b53066 DBUG_ASSERT(fixed == 1); added to val*
small optimisation in signed_literal
2004-03-18 15:14:36 +02:00
bell@sanja.is.com.ua
8035ce40ec DBUG_ASSERT(fixed == 0) added to fix_fields() 2004-03-17 14:26:26 +02:00
bell@sanja.is.com.ua
cd5c30c5dc fix test during merge 2004-03-16 16:30:09 +02:00
bell@sanja.is.com.ua
d2265b6345 merge 2004-03-15 13:16:40 +02:00
bell@sanja.is.com.ua
d3b96b3a6e after merge fix 2004-03-09 14:44:15 +02:00
bell@sanja.is.com.ua
7e48a0f610 merge 2004-03-09 12:52:25 +02:00
hf@deer.(none)
18d722ff93 Merging 2004-03-04 17:52:06 +04:00
bell@sanja.is.com.ua
8a442c4e0d after review fix 2004-02-20 15:37:45 +02:00
bell@sanja.is.com.ua
2d5338ceb0 revision of fix_fields calls in subqueries transformation
after merge fix
2004-02-18 22:14:41 +02:00
bell@sanja.is.com.ua
14b9fa3588 revision of fix_fields() calls (BUG2838) 2004-02-18 01:08:52 +02:00
bell@sanja.is.com.ua
272bd74abb memory leacks in PS with subqueries fixed (adddition to fix of BUG#2462) 2004-02-12 03:10:26 +02:00
bell@sanja.is.com.ua
69e2460bd4 fixed subquery with PS (BUG#2462)
fixed UNION preparation
2004-02-08 20:14:13 +02:00
bell@sanja.is.com.ua
8fdce902f9 avoid null check on fields where NULL is impossible
(BUG#2393)
2004-02-02 02:23:53 +02:00
ram@gw.mysql.r18.ru
6fab168a63 fix for the bug #2419: order by ignores rows.
null_ref_key moved to TABLE_REF.
new null range created if necessary.
2004-01-31 10:04:16 +04:00
hf@deer.(none)
7dda8c102f Merge deer.(none):/home/hf/work/mysql-4.1.clean
into deer.(none):/home/hf/work/mysql-4.1.1676
2004-01-19 21:06:27 +04:00
ram@gw.mysql.r18.ru
e289783cf8 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into gw.mysql.r18.ru:/usr/home/ram/work/4.1.b2182
2004-01-19 13:00:51 +04:00
bell@sanja.is.com.ua
bcbc9ff22f Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-sub-4.1
2004-01-17 11:53:04 +02:00
hf@deer.(none)
bfe134b86f Fix for prepared statements
Here i added Item_*::cleanup() functions,
removed a lot of ~Item_*'s,
added code to restore order_list and group_list
2003-12-30 14:08:19 +04:00
ram@gw.mysql.r18.ru
9dba5a709b Fix for the bug #2198: SELECT INTO OUTFILE (with Sub-Select) Problem.
Proper Item_cache::setup() method.
Code cleanup.
(discussed with sanja)
2003-12-25 18:50:22 +04:00
konstantin@oak.local
d37da004f6 THD::lex now points to THD::main_lex like in 5.0
All tests pass (client_test included)
2003-12-19 20:52:13 +03:00
monty@mysql.com
031390a9a4 Fixes after merge with 4.0
Cleaned up embedded library access and query cache handling
Changed min stack size to 128K (to allow longer MyISAM keys)
Fixed wrong priority for XOR (should be less than NEG to get -1^1 to work)
2003-12-19 16:25:50 +02:00
bell@sanja.is.com.ua
e756a511f8 fixed unlocking tables during subquery execution (BUG#2048) 2003-12-10 22:46:14 +02:00
hf@deer.(none)
dff5b0a75b Fix for #1992
This bug happens when a query, having subselects in the fields list,
needs temporary table.
Item_subselect::get_tmp_table_item isn't implemented and just returns
*this. So the tmp_table_item takes value not from temporary but
from original table.
2003-12-06 23:37:24 +04:00
monty@mysql.com
ede8169d24 Added missing SSL library (Should be in source distribution)
Fixed compiler warnings (a lot of hidden variables detected by the Forte compiler)
Added a lot of 'version_xxx' strings to 'show variables'
Prevent copying of TMP_TABLE_PARAM (This caused core dump bug on Solaris)
Fixed problem with printing sub selects to debug log
2003-11-28 12:18:13 +02:00
bell@sanja.is.com.ua
7191ea0ae3 Fixed UNION fields type/length detecting 2003-11-23 02:01:15 +02:00
bell@sanja.is.com.ua
09cefdd542 limit initialization moved to method of SELECT_LEX_UNIT (WL#695)
(SCRUM)
counters was not moved to SELECT_LEX because it used in methods inherited from select_result which should be applied to whole union results
2003-11-21 21:19:56 +02:00
pem@mysql.com
28a2c6a96b Merging 4.1->5.0. 2003-11-19 15:19:46 +01:00
bell@sanja.is.com.ua
cb19ad9ac1 fixed using 'uncachable' tag and RAND_TABLE_BIT setting 2003-11-17 20:53:40 +02:00
bell@sanja.is.com.ua
c56e75e2c1 after review fix 2003-11-03 12:28:36 +02:00
bell@sanja.is.com.ua
e025adb403 Merge 2003-11-03 08:47:27 +02:00
bell@sanja.is.com.ua
777316c3e1 fixed BUG#1645
all calls of fix_fields() are inspected
(copy of cset which I lost in accidatly tree delete)
2003-11-02 17:27:35 +02:00
bell@sanja.is.com.ua
33f6f72979 join_free now is method of JOIN and commented
dependence should mean uncacheability
2003-11-02 16:31:22 +02:00
bell@sanja.is.com.ua
3e10f80682 fixed part of BUG#1708
(test suite will be with next part)
2003-11-01 19:02:43 +02:00