Commit graph

188 commits

Author SHA1 Message Date
monty@mysql.com
3da5f1c223 Move handling of suffix_length from strnxfrm_bin() to filesort to ensure proper sorting of all kind of binary objects
field::sort_key() now adds length last for varbinary/blob
VARBINARY/BLOB is now sorted by filesort so that shorter strings comes before longer ones
Fixed issues in test cases from last merge
2005-10-14 00:04:52 +03:00
monty@mysql.com
6f5baa1eba Merge mysql.com:/home/my/mysql-4.1
into  mysql.com:/home/my/mysql-5.0
2005-10-13 20:18:37 +03:00
jani@ua141d10.elisa.omakaista.fi
3ef920a7c7 Merged from 4.1. 2005-10-13 19:34:15 +03:00
jani@ua141d10.elisa.omakaista.fi
2dd1e4f94e Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1-tmp
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
2005-10-13 18:23:53 +03:00
hf@deer.(none)
27d8bc5b1f merging 2005-10-13 19:51:07 +05:00
hf@deer.(none)
62ffbea5e4 merging 2005-10-13 19:31:09 +05:00
hf@deer.(none)
c933505d2d Fix for bug #3874 (Group by field is not considered) 2005-10-13 19:23:52 +05:00
evgen@moonbone.local
818c37ac68 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into moonbone.local:/work/13535-bug-4.1-mysql
2005-10-13 17:17:32 +04:00
evgen@moonbone.local
4d2a58f848 Manual merge of bug fix #7672 2005-10-13 16:00:26 +04:00
evgen@moonbone.local
fb0074a6ad Manual merged 2005-10-13 01:14:58 +04:00
evgen@moonbone.local
902b06ecb1 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-4.1
into moonbone.local:/work/13535-bug-4.1-mysql
2005-10-13 00:16:33 +04:00
evgen@moonbone.local
c16410d3a1 Manual merge, fix for bug #7672 2005-10-12 03:32:14 +04:00
lars@mysql.com
af951aa662 After merge fixes 2005-10-10 19:38:58 +02:00
evgen@moonbone.local
6bfc2d4b89 Fix bug#7672 Unknown column error in order clause
When fixing Item_func_plus in ORDER BY clause field c is searched in all
opened tables, but because c is an alias it wasn't found there.

This patch adds a flag to select_lex which allows Item_field::fix_fields() 
to look up in select's item_list to find aliased fields.
2005-10-09 23:05:44 +04:00
monty@mysql.com
82855517a1 Review of new code since last pull
- Use %lx instead of %p as %p is not portable
- Don't replace ROW item with Item_null
2005-10-07 03:12:15 +03:00
evgen@moonbone.local
5a10244d8b Fix bug#13535 Incorrect result from SELECT statement after SHOW TABLE STATUS
After SHOW TABLE STATUS last_insert_id wasn't cleaned, and next select
erroneously rewrites WHERE condition and returs a row;
5.0 isn't affected because of different SHOW TABLE STATUS handling.

last_insert_id cleanup added to mysqld_extend_show_tables().
2005-10-03 23:22:46 +04:00
timour@mysql.com
638198e17d Fix for BUG#13597 - columns in ON condition not resolved if references a table in a nested right join.
The problem was in that when finding the last table reference in a nested join tree,
the procedure doing the iteration over the right-most branches of a join tree
was testing for RIGHT JOINs the table reference that represents the join, and not
the second operand of the JOIN. Currently the information whether a join is LEFT/RIGHT
is stored not on the join object itself, but on one of its operands.
2005-09-30 10:39:17 +03:00
evgen@moonbone.local
1bf2fbdb35 select.result, item.cc:
After merge fix for bug#13356
2005-09-28 21:30:10 +04:00
msvensson@neptunus.(none)
13161c2a84 Merge neptunus.(none):/home/msvensson/mysql/mysql-4.1
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0
2005-09-28 15:32:05 +02:00
evgen@moonbone.local
4f4711bd49 Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items.
resolve_const_item() assumed to be not called for Item_row items. For
ensuring that DBUG_ASSERT(0) was set there.

This patch adds section for Item_row items. If it can it recursively calls
resolve_const_item() for each item the Item_row contains. If any of the
contained items is null then whole Item_row substitued by Item_null. Otherwise
it just returns.
2005-09-28 00:58:12 +04:00
timour@mysql.com
e609eac0d9 Fix for BUG#13127.
The problem was in the way table references are pre-filtered when
resolving a qualified field. When resolving qualified table references
we search recursively in the operands of the join. If there is
natural/using join with a merge view, the first call to find_field_in_table_ref
makes a recursive call to itself with the view as the new table reference
to search for the column. However the view has both nested_join and
join_columns != NULL so it skipped the test whether the view name matches
the field qualifier. As a result the field was found in the view since the
view already has a field with the same name. Thus the field was incorrectly
resolved as the view field.
2005-09-20 14:00:39 +03:00
evgen@moonbone.local
097ca8ad90 Fix bug #12291 Table wasn't reinited for index scan after sequential scan
Optimizer did choose "Range checked for each record" for one of the tables.
For first few loops over that table it choose sequential access, on later
stage it choose to use index. Because table was previously initialized for 
sequential access, it skips intitialization for index access, and when
server tries to retrieve data error occurs.

QUICK_RANGE_SELECT::init() changes so if file already initialized for
sequential access, it calls ha_rnd_end() and initializes file for index
access.
2005-09-16 01:19:43 +04:00
timour@mysql.com
d0f585f11f BUG#12943 - post-merge fix 2005-09-12 19:18:17 +03:00
timour@mysql.com
54db60c080 Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-bug-12943
2005-09-12 19:05:55 +03:00
timour@mysql.com
6a528590d9 Fix for BUG#13067 "JOIN ... USING is case sensitive". 2005-09-12 08:28:53 +03:00
timour@mysql.com
7d24bdac22 Fix for BUG#12943.
The problem was that in the first production in rule 'join_table', that
processes simple cross joins, the parser was processing the second join operand
before the first one due to unspecified priorities of JOINs. As a result in the
case of cross joins the parser constructed a tree with incorrect nesting:
the expression "t1 join t2 join t3 on some_cond" was interpreted as
"t1 join (t2 join t3 on some_cond)" instead of
"(t1 join t2) join t3 on some_cond".
Because of this incorrect nesting the method make_join_on_context picked an
incorrect table as the first table of the name resolution context.

The solution assignes correct priorities to the related production.
2005-09-10 15:01:54 +03:00
timour@mysql.com
912aef9579 Fix for BUG#12977. 2005-09-08 11:29:52 +03:00
andrey@lmy004.
235cde55fb fix for bug #12841
(Server crash on DO IFNULL(NULL,NULL)
(fixes also "SELECT CAST(IFNULL(NULL,NULL) as DECIMAL)" unreported
 crash)
(new revampled fix with suggestions from Igor)
2005-08-29 15:45:03 +02:00
timour@mysql.com
f58315f80a Test for BUG#6495.
The bug itself is fixed by WL#2486.
2005-08-23 22:29:05 +03:00
timour@mysql.com
5f9d05d306 Test for BUG#4889 - inconsistent resilts of more than 2-way natural join
due to incorrect transformation to JOIN ... ON.

The bug itself is fixed by WL#2486.
2005-08-23 20:24:29 +03:00
timour@mysql.com
9a6aefab3a Fix for BUG#6276. 2005-08-23 20:03:32 +03:00
timour@mysql.com
2f2347e556 Test case for BUG#10972 - Natural join of view and underlying table gives wrong result.
The bug itself is fixed by WL#2486.
2005-08-23 19:00:28 +03:00
timour@mysql.com
f5655423aa Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-2486
2005-08-23 18:43:12 +03:00
timour@mysql.com
bf8563ae1d Merge mysql.com:/home/timka/mysql/src/5.0-virgin
into  mysql.com:/home/timka/mysql/src/5.0-2486
2005-08-23 18:15:51 +03:00
timour@mysql.com
e040300393 WL#2486 - natural and using join according to SQL:2003
* Provide backwards compatibility extension to name resolution of
  coalesced columns. The patch allows such columns to be qualified
  with a table (and db) name, as it is in 4.1.
  Based on a patch from Monty.

* Adjusted tests accordingly to test both backwards compatible name
  resolution of qualified columns, and ANSI-style resolution of
  non-qualified columns.
  For this, each affected test has two versions - one with qualified
  columns, and one without.
2005-08-23 18:08:04 +03:00
timour@mysql.com
310afc80dd Test case for BUG#10646
The bug itself is fixed by WL #2486.
2005-08-22 17:34:08 +03:00
timour@mysql.com
c04138ec94 Test case for BUG#6558 - Views: create fails with JOIN ... USING
The bug is non-view specific, and it resulted from incorrect
name resolution of natural join result columns. The bug is
fixed by WL#2486.
2005-08-22 17:04:55 +03:00
evgen@moonbone.local
f5f6ed8b78 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into moonbone.local:/work/11398-bug-5.0-mysql
2005-08-22 15:46:09 +04:00
jimw@mysql.com
15f97778ff Revert patch for Bug #12595, it causes the sql_mode test to fail. 2005-08-17 19:56:14 -07:00
timour@mysql.com
a55786ca70 WL#2486 - natural and using join according to SQL:2003
- fixed a problem with RIGHT JOIN ON and enabled corresponding tests in select.test
- fixed a memory leak
2005-08-17 17:19:31 +03:00
evgen@moonbone.local
eb6135a765 Fix bug #11398 Bug in field_conv() results in wrong result of join with index
When copying varchar fields with field_conv() it's not taken into account
that length_bytes of source and destination fields may be different.
This results in saving wrong data in field and making wrong key later.

Added check so if fields are varchar and have different length_bytes they
are not copied by memcpy().
2005-08-16 22:13:43 +04:00
andrey@lmy004.
a7a762e27d fix for bug #12595 (Escape character has to be exactly one) 2005-08-16 15:39:40 +02:00
timour@mysql.com
a247282aa6 Implementation of WL#2486 -
"Process NATURAL and USING joins according to SQL:2003".

* Some of the main problems fixed by the patch:
  - in "select *" queries the * expanded correctly according to
    ANSI for arbitrary natural/using joins
  - natural/using joins are correctly transformed into JOIN ... ON
    for any number/nesting of the joins.
  - column references are correctly resolved against natural joins
    of any nesting and combined with arbitrary other joins.

* This patch also contains a fix for name resolution of items
  inside the ON condition of JOIN ... ON - in this case items must
  be resolved only against the JOIN operands. To support such
  'local' name resolution, the patch introduces a stack of
  name resolution contexts used at parse time.

NOTICE:
- This patch is not complete in the sense that
  - there are 2 test cases that still do not pass -
    one in join.test, one in select.test. Both are marked
    with a comment "TODO: WL#2486".
  - it does not include a new test specific for the task
2005-08-12 17:57:19 +03:00
monty@mysql.com
b3cbd0048f Cleanups during review of new code
Ensure mysql_close() is called if mysql_set_character_set() fails
2005-07-28 16:10:14 +03:00
jimw@mysql.com
63c6ece728 Cleanups after merge from 4.1. 2005-07-19 16:32:38 -07:00
jimw@mysql.com
80c1c6b33f Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2005-07-19 11:05:49 -07:00
monty@mishka.local
7e83d09ce7 Simple fixes during review of new code 2005-07-19 19:25:05 +03:00
konstantin@mysql.com
52b8928b09 Merge mysql.com:/home/kostja/mysql/mysql-4.1-root
into  mysql.com:/home/kostja/mysql/mysql-5.0-merge
2005-07-19 00:55:37 +04:00
igor@rurik.mysql.com
54dd7e5ebf select.result, select.test:
Added a test case for bug #11745.
sql_select.cc:
  Fixed bug # 11745.
  Added support of where clause for queries with FROM DUAL.
sql_yacc.yy:
  Fixed bug # 11745.
  Added optional where clause for queries with FROM DUAL.
2005-07-17 09:46:14 -07:00
konstantin@mysql.com
8e72214d74 Merge mysql.com:/opt/local/work/mysql-4.1-root
into  mysql.com:/media/sda1/mysql/mysql-5.0-merge
2005-07-16 13:45:32 +04:00