Commit graph

657 commits

Author SHA1 Message Date
cmiller@zippy.cornsilk.net
94c4c966f8 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug27047/my50-prece-bug27047
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
2007-03-27 11:34:16 -04:00
cmiller@zippy.cornsilk.net
bfbafe4c8e Bug#26600: table PROFILING in INFORMATION SCHEMA has wrong data type
Bug#27047[partial]: INFORMATION_SCHEMA table cannot have BIGINT \
	fields

No Information_schema table has ever needed floating-point data 
before.  Transforming all floating point to a string and back to a
number causes a real data problem on Windows, where the libc may 
pad the exponent with more leading zeroes than we expect and the
significant digits are truncated away.

This also makes interpreting an unimplemented type as a string into
a fatal error in debug builds.  Thus, we will catch problems when we
try to use those types in new I_S tables.
2007-03-27 11:30:53 -04: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
gkodinov/kgeorge@magare.gmz
8c1f70aef6 Bug #26794:
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE. 
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
2007-03-14 11:54:20 +02:00
anozdrin/alik@booka.opbmk
bd5b38d66c Fix typo. 2007-03-09 10:44:48 +03:00
anozdrin/alik@booka.opbmk
c666e2f276 Polishing: use constants instead of magic numbers. 2007-03-09 08:05:08 +03:00
monty@mysql.com/narttu.mysql.fi
e5cc397f33 Fixed compiler warnings (for linux and win32 and win64)
Fixed a couple of usage of not initialized warnings (unlikely cases)
2007-02-22 16:59:57 +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
gluh@mysql.com/eagle.(none)
47e537b47c Bug#24630 Subselect query crashes mysqld
The crash happens because second filling of the same I_S table happens in
case of subselect with order by. table->sort.io_cache previously allocated
in create_sort_index() is deleted during second filling
(function get_schema_tables_result). There are two places where
I_S table can be filled: JOIN::exec and create_sort_index().
To fix the bug we should check if the table was already filled
in one of these places and skip processing of the table in second.
2007-02-12 16:06:14 +04:00
gluh@mysql.com/eagle.(none)
d1185aaeaf Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail
additional call of file->extra() method with HA_EXTRA_NO_CACHE parameter
2007-02-01 19:12:45 +04: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
kostja@bodhi.local
d7a63c0f6a Manual merge. 2007-01-15 13:10:07 +03: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
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
kostja@bodhi.local
758404b238 Merge bodhi.local:/opt/local/work/mysql-4.1-4968
into  bodhi.local:/opt/local/work/mysql-5.0-4968-pull-from-4.1
2006-12-12 01:23:30 +03:00
kostja@bodhi.local
90072e69b3 A fix and test cases for
Bug#4968 "Stored procedure crash if cursor opened on altered table"
Bug#19733 "Repeated alter, or repeated create/drop, fails"
Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from 
stored procedure."
Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"

Test cases for bugs 4968, 19733, 6895 will be added in 5.0.

Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE 
statements in stored routines or as prepared statements caused
incorrect results (and crashes in versions prior to 5.0.25).
In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE
SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options).

The problem of bugs 4968, 19733, 19282 and 6895 was that functions
mysql_prepare_table, mysql_create_table and mysql_alter_table were not
re-execution friendly: during their operation they used to modify contents
of LEX (members create_info, alter_info, key_list, create_list),
thus making the LEX unusable for the next execution.
In particular, these functions removed processed columns and keys from
create_list, key_list and drop_list. Search the code in sql_table.cc 
for drop_it.remove() and similar patterns to find evidence.

The fix is to supply to these functions a usable copy of each of the
above structures at every re-execution of an SQL statement. 

To simplify memory management, LEX::key_list and LEX::create_list
were added to LEX::alter_info, a fresh copy of which is created for
every execution.

The problem of crashing bug 22060 stemmed from the fact that the above 
metnioned functions were not only modifying HA_CREATE_INFO structure in 
LEX, but also were changing it to point to areas in volatile memory of 
the execution memory root.
 
The patch solves this problem by creating and using an on-stack
copy of HA_CREATE_INFO (note that code in 5.1 already creates and
uses a copy of this structure in mysql_create_table()/alter_table(),
but this approach didn't work well for CREATE TABLE SELECT statement).
2006-12-08 02:20:09 +03: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
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
igor@rurik.mysql.com
79abdb38f8 Merge rurik.mysql.com:/home/igor/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug21727
2006-11-01 14:50:14 -08:00
igor@rurik.mysql.com
2a7acba7e1 Fixed bug #21727.
This is a performance issue for queries with subqueries evaluation
of which requires filesort.
Allocation of memory for the sort buffer at each evaluation of a
subquery may take a significant amount of time if the buffer is rather big.
With the fix we allocate the buffer at the first evaluation of the
subquery and reuse it at each subsequent evaluation.
2006-10-31 17:31:56 -08:00
ramil/ram@mysql.com/myoffice.izhnet.ru
b1e77ed1fd Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/usr/home/ram/work/bug22723/my50-bug22723
2006-10-31 13:28:44 +04:00
andrey@example.com
6237be99d0 Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  example.com:/work/bug23037/my50
2006-10-23 15:21:23 +02:00
andrey@example.com
389c6a019e Fix for bug#23037 Bug in field "Default" of query "SHOW COLUMNS FROM table"
To the documentor: The DEFAULT value in SHOW COLUMNS/SELECT FROM I_S.COLUMNS
was truncated to NAME_LEN (which effectively is 64) characters.
2006-10-23 13:12:30 +02:00
ramil/ram@mysql.com/myoffice.izhnet.ru
0bbae9b3c5 Fix for bug #22723: Host field blank when server started with skip-grant
We set 'host_or_ip' to "" in the Security_context::skip_grants().
2006-10-20 15:08:25 +05:00
gluh@mysql.com/gluh.(none)
229bb9dcf1 Bug#20862 truncated result with show variables like 'innodb_data_file_path'
The size of 'value' field is increased to FN_REFLEN
2006-09-11 17:27:35 +05:00
holyfoot/hf@mysql.com/deer.(none)
de7e53d531 bug #20910 (NOT NULL reported as NULL for TIMESTAMP)
we intentionally reported that for TIMESTAMPS, which isn't right
2006-08-08 13:34:27 +05:00
rburnett@bk-internal.mysql.com
22c77e87a2 Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into  bk-internal.mysql.com:/data0/bk/mysql-5.0-kt
2006-08-03 16:54:06 +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
kroki/tomash@moonlight.intranet
c867301b0d Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug16581
2006-07-28 18:07:47 +04:00
kroki/tomash@moonlight.intranet
d06001b1a2 Bug#16581: deadlock: server and client both read from connection in
'conc_sys' test

Concurrent execution of SELECT involing at least two INFORMATION_SCHEMA
tables, DROP DATABASE statement and DROP TABLE statement could have
resulted in stalled connection for this SELECT statement.

The problem was that for the first query of a join there was a race
between select from I_S.TABLES and DROP DATABASE, and the error (no
such database) was prepared to be send to the client, but the join
processing was continued.  On second query to I_S.COLUMNS there was a
race with DROP TABLE, but this error (no such table) was downgraded to
warning, and thd->net.report_error was reset.  And so neither result
nor error was sent to the client.

The solution is to stop join processing once it is clear we are going
to report a error, and also to downgrade to warnings file system errors
like 'no such database' (unless we are in the 'SHOW' command), because
I_S is designed not to use locks and the query to I_S should not abort
if something is dropped in the middle.

No test case is provided since this bug is a result of a race, and is
timing dependant.  But we test that plain SHOW TABLES and SHOW COLUMNS
give a error if there is no such database or a table respectively.
2006-07-28 15:06:23 +04:00
anozdrin/alik@booka.
b7f403b546 Fix for BUG#16211: Stored function return type for strings is ignored.
Fix for BUG#16676: Database CHARSET not used for stored procedures

The problem in BUG#16211 is that CHARSET-clause of the return type for
stored functions is just ignored.

The problem in BUG#16676 is that if character set is not explicitly
specified for sp-variable, the server character set is used instead
of the database one.

The fix has two parts:

  - always store CHARSET-clause of the return type along with the
    type definition in mysql.proc.returns column. "Always" means that
    CHARSET-clause is appended even if it has not been explicitly
    specified in CREATE FUNCTION statement (this affects BUG#16211 only).

    Storing CHARSET-clause if it is not specified is essential to avoid
    changing character set if the database character set is altered in
    the future.

    NOTE: this change is not backward compatible with the previous releases.

  - use database default character set if CHARSET-clause is not explicitly
    specified (this affects both BUG#16211 and BUG#16676).

    NOTE: this also breaks backward compatibility.
2006-07-27 17:57:43 +04:00
gluh@mysql.com/gluh.(none)
e47b22c6a2 Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view 
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
2006-07-25 17:23:25 +05:00
igor@olga.mysql.com
69856b29b2 Fixed bug #21231: wrong results for a simple query with a
a non-correlated single-row subquery over information schema.

The function get_all_tables filling all information schema
tables reset lex->sql_command to SQLCOM_SHOW_FIELDS. After
this the function could evaluate partial conditions related to
some columns. If these conditions contained a subquery over
information schema it led to a wrong evaluation and a wrong 
result set.
This bug was already fixed in 5.1.
This patch follows the way how it was done in 5.1 where
the value of lex->sql_command is set to SQLCOM_SHOW_FIELDS
in get_all_tables only for the calls of the function 
open_normal_and_derived_tables and is restored after these
calls.
2006-07-24 19:05:46 -07:00
igor@olga.mysql.com
66ecb7df81 Fixed bug #18925: wrong results for queries with
subqueries on information schema that use MIN/MAX aggregation.

Execution of some correlated subqueries may set the value
of null_row to 1 for tables used in the subquery.
If the the subquery is on information schema it causes
rejection of any row for the following executions of
the subquery in the case when an optimization filtering
by some condition is applied.

The fix restores the value of the null_row flag for 
each execution of a subquery on information schema.
2006-07-22 12:44:54 -07:00
gluh@mysql.com
d2b378d57f Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/gluh/MySQL/Merge/5.0-kt
2006-07-03 13:19:18 +05:00
kroki@mysql.com
1bcf6b1d09 Bug#20230: routine_definition is not null
SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION are fixed as well as
INFORMATION_SCHEMA.ROUTINES.ROUTINE_NAME.
2006-06-30 00:21:55 +04:00
gluh@eagle.intranet.mysql.r18.ru
a230166f28 Fix for bug#13934 Silent truncation of table comments
Table comment: issue a warning(error in traditional mode) if length of comment > 60 symbols
Column comment: issue a warning(error in traditional mode) if length of comment > 255 symbols
Table 'comment' is changed from char* to LEX_STRING
2006-06-29 18:39:34 +05:00
gluh@eagle.intranet.mysql.r18.ru
f9214221fc Bug#19671 mysql_list_fields returns incorrect table name for VIEWs
After view onening real view db name and table name are placed
into table_list->view_db & table_list->view_name.
Item_field class does not handle these names properly during 
intialization of Send_field.
The fix is to use new class 'Item_ident_for_show' 
which sets correct view db name and table name for Send_field.
2006-06-29 16:52:46 +05:00
holyfoot@deer.(none)
f1ed5a40d6 bug #16832 (ALGORITHM missed in VIEW's information schema) 2006-06-13 17:23:43 +05:00
gluh@eagle.intranet.mysql.r18.ru
03d8717ac8 Bug#17661 information_schema.SCHEMATA returns uppercase with lower_case_table_names = 1
fix: return db name for I_S.TABLES(and others) in original letter case.
if mysql starts with lower_case_table_names=1 | 2 then original db name is converted
to lower case(for I_S tables). It happens when we perform add_table_to_list. 
to avoid this we make a copy of original db name and use the copy hereafter.
2006-06-06 11:25:31 +05:00
gluh@eagle.intranet.mysql.r18.ru
ae72df07f2 Bug#17204 "second CALL to procedure crashes Server"
Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views"
This bug caused crashes or resulted in wrong data being returned
when one tried to obtain information from I_S tables about views
using stored functions.

It was caused by the fact that we were using LEX representing
statement which were doing select from I_S tables as active LEX
when contents of I_S table were built. So state of this LEX both
affected and was affected by open_tables() calls which happened
during this process. This resulted in wrong behavior and in
violations of some of invariants which caused crashes.

This fix tries to solve this problem by properly saving/resetting
and restoring part of LEX which affects and is affected by the
process of opening tables and views in get_all_tables() routine.
To simplify things we separated this part of LEX in a new class
and made LEX its descendant.
2006-05-30 10:45:23 +05:00
gluh@eagle.intranet.mysql.r18.ru
457aea43fc Bug#16681 information_schema shows forbidden VIEW details
show view definition to users that have the needed privilleges
2006-05-23 12:45:25 +05:00
gluh@eagle.intranet.mysql.r18.ru
a23a8780e4 Fix for bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
replaced get_field(MEM_ROOT *mem, Field *field) with 
get_field(MEM_ROOT *mem, Field *field, String *res).
It allows to avoid strlen().
2006-05-12 17:34:36 +05:00
gluh@eagle.intranet.mysql.r18.ru
c8944add73 Fix for bug#19236 bad COLUMNS.CHARACTER_MAXIMUM_LENGHT and CHARACTER_OCTET_LENGTH 2006-05-12 15:09:25 +05:00
jani@ua141d10.elisa.omakaista.fi
0410832526 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
2006-05-04 18:35:58 +03:00
jani@hundin.mysql.fi
d3467c0b4c Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-4.1
into  hundin.mysql.fi:/home/jani/mysql-4.1
2006-05-04 13:17:16 +03:00
tnurnberg@mysql.com
5becb110e0 Bug#19025 4.1 mysqldump doesn't correctly dump "auto_increment = [int]"
mysqldump / SHOW CREATE TABLE will show the NEXT available value for
the PK, rather than the *first* one that was available (that named in
the original CREATE TABLE ... AUTO_INCREMENT = ... statement).

This should produce correct and robust behaviour for the obvious use
cases -- when no data were inserted, then we'll produce a statement
featuring the same value the original CREATE TABLE had; if we dump
with values, INSERTing the values on the target machine should set the
correct next_ID anyway (and if not, we'll still have our AUTO_INCREMENT =
... to do that). Lastly, just the CREATE statement (with no data) for
a table that saw inserts would still result in a table that new values
could safely be inserted to).

There seems to be no robust way however to see whether the next_ID
field is > 1 because it was set to something else with CREATE TABLE
... AUTO_INCREMENT = ..., or because there is an AUTO_INCREMENT column
in  the table (but no initial value was set with AUTO_INCREMENT = ...)
and then one or more rows were INSERTed, counting up next_ID. This
means that in both cases, we'll generate an AUTO_INCREMENT =
... clause in SHOW CREATE TABLE / mysqldump.  As we also show info on,
say, charsets even if the user did not explicitly give that info in
their own CREATE TABLE, this shouldn't be an issue.

As per above, the next_ID will be affected by any INSERTs that have
taken place, though.  This /should/ result in correct and robust
behaviour, but it may look non-intuitive to some users if they CREATE
TABLE ... AUTO_INCREMENT = 1000 and later (after some INSERTs) have
SHOW CREATE TABLE give them a different value (say, CREATE TABLE
... AUTO_INCREMENT = 1006), so the docs should possibly feature a
caveat to that effect.

It's not very intuitive the way it works now (with the fix), but it's
*correct*.  We're not storing the original value anyway, if we wanted
that, we'd have to change on-disk representation?

If we do dump/load cycles with empty DBs, nothing will change.  This
changeset includes an additional test case that proves that tables
with rows will create the same next_ID for AUTO_INCREMENT = ... across
dump/restore cycles.

Confirmed by support as likely solution for client's problem.
2006-05-04 03:12:51 +02:00
jani@a193-229-222-105.elisa-laajakaista.fi
a7a8143941 Fix for Bug#14515. 2006-04-30 16:01:34 +03:00
gluh@eagle.intranet.mysql.r18.ru
f78ae59f0f Fix for bug#18224 VIEW on information_schema crashes the server
additional check for subselect
2006-03-20 14:17:47 +04:00
gluh@eagle.intranet.mysql.r18.ru
a184a00eae Fix for bug #18113 "SELECT * FROM information_schema.xxx crashes server"
Crash happened when one selected data from one of INFORMATION_SCHEMA
tables and in order to build its contents server had to open view which
used stored function and table or view on which one had not global or
database-level privileges (e.g. had only table-level or had no
privileges at all).

The crash was caused by usage of check_grant() function, which assumes
that either number of tables to be inspected by it is limited explicitly
or table list used and thd->lex->query_tables_own_last value correspond
to each other (the latter should be either 0 or point to next_global
member of one of elements of this table list), in conditions when
above assumptions were not true. This fix just explicitly limits
number of tables to be inspected. Other negative effects which are
caused by the fact that thd->lex->query_tables_own_last might not
be set properly during processing of I_S tables are less disastrous
and will be reported and fixed separetely.
2006-03-20 13:42:02 +04:00