summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-07-24 19:55:08 +0300
committerunknown <monty@mashka.mysql.fi>2002-07-24 19:55:08 +0300
commit72dec69046e315080d17e4764f911c4c9f29459c (patch)
tree31ee919bea7e4456572b62d5ea7302dc58bc0b6a
parentc911e9d72161045364893a838624c1484590a9cb (diff)
downloadmariadb-git-72dec69046e315080d17e4764f911c4c9f29459c.tar.gz
Removed wrong implementation of CUBE/ROLLUP
Fixed bugfix of INSERT ... SET db_name.table_name.column_name Changed locking to external-locking Fix client hangup for some invalid SQL queries. Docs/manual.texi: Changelog & recent incompatible changes to 4.0.3 include/mysqld_error.h: New error messages myisam/ft_boolean_search.c: Removed compiler warning myisam/mi_check.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_dynrec.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_extra.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_key.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_open.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/mi_packrec.c: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/myisamdef.h: Change mi_fix_rec_buff_for_blob to mi_alloc_rec_buff myisam/sort.c: Fixed uninitialized variable mysql-test/r/insert_set.result: Change test case to use database foo mysql-test/r/union.result: Test wrong usage of union mysql-test/t/insert_set.test: Test bug in insert mysql-test/t/union.test: Test wrong usage of union sql/item.h: Indentation cleanup sql/item_cmpfunc.h: Indentation cleanup sql/item_func.h: Indentation cleanup sql/item_strfunc.h: Indentation cleanup sql/item_sum.h: Indentation cleanup sql/item_timefunc.h: Indentation cleanup sql/item_uniq.h: Indentation cleanup sql/mysql_priv.h: Fix that we always generate an error message when calling YYABORT sql/mysqld.cc: Changed command line arguments regarding locking to always use --external-locking Disable external locking by default sql/procedure.h: Cleanup sql/set_var.cc: change locking -> external_locking sql/share/czech/errmsg.txt: New error messages sql/share/danish/errmsg.txt: New error messages sql/share/dutch/errmsg.txt: New error messages sql/share/english/errmsg.txt: New error messages sql/share/estonian/errmsg.txt: New error messages sql/share/french/errmsg.txt: New error messages sql/share/german/errmsg.txt: New error messages sql/share/greek/errmsg.txt: New error messages sql/share/hungarian/errmsg.txt: New error messages sql/share/italian/errmsg.txt: New error messages sql/share/japanese/errmsg.txt: New error messages sql/share/korean/errmsg.txt: New error messages mysql-test/r/olap.result: Removed CUBE/ROLLUP mysql-test/t/olap.test: Removed CUBE/ROLLUP sql/share/norwegian-ny/errmsg.txt: New error messages sql/share/norwegian/errmsg.txt: New error messages sql/share/polish/errmsg.txt: New error messages sql/share/portuguese/errmsg.txt: New error messages sql/share/romanian/errmsg.txt: New error messages sql/share/russian/errmsg.txt: New error messages sql/share/slovak/errmsg.txt: New error messages sql/share/spanish/errmsg.txt: New error messages sql/share/swedish/errmsg.txt: New error messages sql/share/ukrainian/errmsg.txt: New error messages sql/sql_base.cc: Removed wrong patch for INSERT... sql/sql_insert.cc: Fix bug in INSERT ... SET db_name.table_name.column_name sql/sql_lex.h: Changed NON_EXISTIONG_ONE -> UNSPECIFIED_OLAP_TYPE sql/sql_olap.cc: Removed wrong implementation of CUBE/ROLLUP sql/sql_parse.cc: Removed wrong implementation of CUBE/ROLLUP Added function to give better error messages sql/sql_select.cc: Removed wrong implementation of CUBE/ROLLUP sql/sql_union.cc: Added comment sql/sql_yacc.yy: Fix that we always generate an error message when calling YYABORT
-rw-r--r--Docs/manual.texi244
-rw-r--r--include/mysqld_error.h4
-rw-r--r--myisam/ft_boolean_search.c3
-rw-r--r--myisam/mi_check.c8
-rw-r--r--myisam/mi_dynrec.c24
-rw-r--r--myisam/mi_extra.c3
-rw-r--r--myisam/mi_key.c4
-rw-r--r--myisam/mi_open.c18
-rw-r--r--myisam/mi_packrec.c10
-rw-r--r--myisam/myisamdef.h3
-rw-r--r--myisam/sort.c2
-rw-r--r--mysql-test/r/insert_set.result10
-rw-r--r--mysql-test/r/olap.result121
-rw-r--r--mysql-test/r/union.result2
-rw-r--r--mysql-test/t/insert_set.test10
-rw-r--r--mysql-test/t/olap.test5
-rw-r--r--mysql-test/t/union.test7
-rw-r--r--sql/item.h42
-rw-r--r--sql/item_cmpfunc.h30
-rw-r--r--sql/item_func.h46
-rw-r--r--sql/item_strfunc.h52
-rw-r--r--sql/item_sum.h34
-rw-r--r--sql/item_timefunc.h20
-rw-r--r--sql/item_uniq.h4
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/mysqld.cc27
-rw-r--r--sql/procedure.h8
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/share/czech/errmsg.txt2
-rw-r--r--sql/share/danish/errmsg.txt2
-rw-r--r--sql/share/dutch/errmsg.txt2
-rw-r--r--sql/share/english/errmsg.txt2
-rw-r--r--sql/share/estonian/errmsg.txt2
-rw-r--r--sql/share/french/errmsg.txt2
-rw-r--r--sql/share/german/errmsg.txt2
-rw-r--r--sql/share/greek/errmsg.txt2
-rw-r--r--sql/share/hungarian/errmsg.txt2
-rw-r--r--sql/share/italian/errmsg.txt2
-rw-r--r--sql/share/japanese/errmsg.txt2
-rw-r--r--sql/share/korean/errmsg.txt2
-rw-r--r--sql/share/norwegian-ny/errmsg.txt2
-rw-r--r--sql/share/norwegian/errmsg.txt2
-rw-r--r--sql/share/polish/errmsg.txt2
-rw-r--r--sql/share/portuguese/errmsg.txt2
-rw-r--r--sql/share/romanian/errmsg.txt2
-rw-r--r--sql/share/russian/errmsg.txt2
-rw-r--r--sql/share/slovak/errmsg.txt2
-rw-r--r--sql/share/spanish/errmsg.txt2
-rw-r--r--sql/share/swedish/errmsg.txt2
-rw-r--r--sql/share/ukrainian/errmsg.txt2
-rw-r--r--sql/sql_base.cc2
-rw-r--r--sql/sql_insert.cc1
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_olap.cc15
-rw-r--r--sql/sql_parse.cc32
-rw-r--r--sql/sql_select.cc23
-rw-r--r--sql/sql_union.cc2
-rw-r--r--sql/sql_yacc.yy180
58 files changed, 504 insertions, 541 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 6c2e1bb051d..3bd9005f87d 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -779,7 +779,7 @@ insert of many rows.
@item Locking -- Gamma
This is very system-dependent. On some systems there are big problems
using standard OS locking (@code{fcntl()}). In these cases, you should
-run @code{mysqld} with the @code{--skip-locking} flag.
+run @code{mysqld} with the @code{--skip-external-locking} flag.
Problems are known to occur on some Linux systems, and on SunOS when
using NFS-mounted filesystems.
@@ -7300,7 +7300,9 @@ programs.
@item
When MySQL is compiled using MIT-pthreads, system locking is
disabled by default for performance reasons. You can tell the server to use
-system locking with the @code{--use-locking} option.
+system locking with the @code{--external-locking} option. This is only
+needed if you want to be able to run two MySQL server against the same
+data files (not recommended).
@item
Sometimes the pthread @code{bind()} command fails to bind to a socket without
@@ -8130,6 +8132,9 @@ before. In particular, you will need @code{REPLICATION SLAVE}
The startup parameters @code{myisam_max_extra_sort_file_size} and
@code{myisam_max_extra_sort_file_size} are now given in bytes
(was megabytes before 4.0.3).
+External system locking of MyISAM/ISAM files is now turned of by default.
+One can turn this one by doing @code{--external-locking}. (For most users
+this is never needed).
@item
The following startup variables/options have been renamed:
@multitable @columnfractions .50 .50
@@ -8142,7 +8147,8 @@ The following startup variables/options have been renamed:
@item @code{warnings} @tab @code{log-warnings}
@end multitable
-The startup options @code{record_buffer}, @code{sort_buffer} and @code{warnings} will still work in MySQL 4.0 but are deprecated.
+The startup options @code{record_buffer}, @code{sort_buffer} and
+@code{warnings} will still work in MySQL 4.0 but are deprecated.
@item
The following SQL variables have changed name.
@multitable @columnfractions .50 .50
@@ -8157,6 +8163,10 @@ The old names still work in MySQL 4.0 but are depricated.
You have to use @code{SET GLOBAL SQL_SLAVE_SKIP_COUNTER=#} instead of
@code{SET SQL_SLAVE_SKIP_COUNTER=#}.
@item
+Renamed mysqld startup options @code{--skip-locking} to
+@code{--skip-external-locking} and @code{--enable-locking} to
+@code{--external-locking}.
+@item
@code{DOUBLE} and @code{FLOAT} columns now honour the
@code{UNSIGNED} flag on storage (before, @code{UNSIGNED} was ignored for
these columns).
@@ -14174,7 +14184,7 @@ Don't flush key buffers between writes for any @code{MyISAM} table.
Read the default keys used by @code{DES_ENCRYPT()} and @code{DES_DECRYPT()}
from this file.
-@item --enable-locking
+@item --enable-external-locking (was --enable-locking)
Enable system locking. Note that if you use this option on a system on
which @code{lockd} does not fully work (as on Linux), you will easily get
mysqld to deadlock.
@@ -14243,7 +14253,7 @@ also set this explicitly to @code{""} if you want to disable this
option. If this option is used, @code{mysqld} will on open check if the
table is marked as crashed or if the table wasn't closed properly.
(The last option only works if you are running with
-@code{--skip-locking}.) If this is the case @code{mysqld} will run
+@code{--skip-external-locking}.) If this is the case @code{mysqld} will run
check on the table. If the table was corrupted, @code{mysqld} will
attempt to repair it.
@@ -14334,7 +14344,7 @@ flush-privileges} or @code{mysqladmin reload}.)
Never use host name cache for faster name-ip resolution, but query DNS server
on every connect instead. @xref{DNS}.
-@item --skip-locking
+@item --skip-extrnal-locking (was --skip-locking)
Don't use system locking. To use @code{isamchk} or @code{myisamchk} you must
shut down the server. @xref{Stability}. Note that in MySQL Version
3.23 you can use @code{REPAIR} and @code{CHECK} to repair/check @code{MyISAM}
@@ -18084,7 +18094,7 @@ Print the @code{myisamchk} version and exit.
@item -w or, --wait
Instead of giving an error if the table is locked, wait until the table
is unlocked before continuing. Note that if you are running @code{mysqld}
-on the table with @code{--skip-locking}, the table can only be locked
+on the table with @code{--skip-external-locking}, the table can only be locked
by another @code{myisamchk} command.
@end table
@@ -18125,11 +18135,11 @@ Should, however, be good enough for most cases.
Store in the @file{.MYI} file when the table was checked and if the table crashed. This should be used to get full benefit of the
@code{--check-only-changed} option, but you shouldn't use this
option if the @code{mysqld} server is using the table and you are
-running @code{mysqld} with @code{--skip-locking}.
+running @code{mysqld} with @code{--skip-external-locking}.
@item -T or --read-only
Don't mark table as checked. This is useful if you use @code{myisamchk}
to check a table that is in use by some other application that doesn't
-use locking (like @code{mysqld --skip-locking}).
+use locking (like @code{mysqld --skip-external-locking}).
@end table
@@ -18289,9 +18299,9 @@ If you have a problem with disk space during repair, you can try to use
@cindex crash, recovery
@cindex recovery, from crash
-If you run @code{mysqld} with @code{--skip-locking} (which is the default on
-some systems, like Linux), you can't reliably use @code{myisamchk} to
-check a table when @code{mysqld} is using the same table. If you
+If you run @code{mysqld} with @code{--skip-external-locking} (which is the
+default on some systems, like Linux), you can't reliably use @code{myisamchk}
+to check a table when @code{mysqld} is using the same table. If you
can be sure that no one is accessing the tables through @code{mysqld}
while you run @code{myisamchk}, you only have to do @code{mysqladmin
flush-tables} before you start checking the tables. If you can't
@@ -18300,14 +18310,14 @@ check the tables. If you run @code{myisamchk} while @code{mysqld} is updating
the tables, you may get a warning that a table is corrupt even if it
isn't.
-If you are not using @code{--skip-locking}, you can use @code{myisamchk}
-to check tables at any time. While you do this, all clients that try
-to update the table will wait until @code{myisamchk} is ready before
+If you are not using @code{--skip-external-locking}, you can use
+@code{myisamchk} to check tables at any time. While you do this, all clients
+that try to update the table will wait until @code{myisamchk} is ready before
continuing.
If you use @code{myisamchk} to repair or optimise tables, you
@strong{must} always ensure that the @code{mysqld} server is not using
-the table (this also applies if you are using @code{--skip-locking}).
+the table (this also applies if you are using @code{--skip-external-locking}).
If you don't take down @code{mysqld} you should at least do a
@code{mysqladmin flush-tables} before you run @code{myisamchk}.
Your tables @strong{may be corrupted} if the server and @code{myisamchk}
@@ -18688,8 +18698,8 @@ here. We explain some of the information in more detail later:
@item myisamchk -d tbl_name
Runs @code{myisamchk} in ``describe mode'' to produce a description of
your table. If you start the MySQL server using the
-@code{--skip-locking} option, @code{myisamchk} may report an error for a
-table that is updated while it runs. However, because @code{myisamchk}
+@code{--skip-external-locking} option, @code{myisamchk} may report an error
+for a table that is updated while it runs. However, because @code{myisamchk}
doesn't change the table in describe mode, there isn't any risk of
destroying data.
@@ -20333,7 +20343,7 @@ The thread is wating for the client to send a new command to it.
The thread is waiting for getting to get a external system lock for the
table. If you are not using multiple mysqld servers that are accessing
the same tables, you can disable system locks with the
-@code{--skip-locking} option.
+@code{--skip-external-locking} option.
@item @code{Upgrading lock}
The @code{INSERT DELAYED} handler is trying to get a lock for the table
to insert rows.
@@ -21352,8 +21362,8 @@ Display version information and exit.
@item -w, --wait
Wait and retry if table is in use. If the @code{mysqld} server was
-invoked with the @code{--skip-locking} option, it is not a good idea to
-invoke @code{myisampack} if the table might be updated during the
+invoked with the @code{--skip-external-locking} option, it is not a good idea
+to invoke @code{myisampack} if the table might be updated during the
packing process.
@end table
@@ -27195,25 +27205,25 @@ If you have enough RAM, you could remove all swap devices. Some
operating systems will use a swap device in some contexts even if you
have free memory.
@item
-Use the @code{--skip-locking} MySQL option to avoid external
+Use the @code{--skip-external-locking} MySQL option to avoid external
locking. Note that this will not impact MySQL's functionality as
long as you only run one server. Just remember to take down the server (or
lock relevant parts) before you run @code{myisamchk}. On some system
this switch is mandatory because the external locking does not work in any
case.
-The @code{--skip-locking} option is on by default when compiling with
+The @code{--skip-external-locking} option is on by default when compiling with
MIT-pthreads, because @code{flock()} isn't fully supported by
MIT-pthreads on all platforms. It's also on default for Linux
as Linux file locking are not yet safe.
-The only case when you can't use @code{--skip-locking} is if you run
+The only case when you can't use @code{--skip-external-locking} is if you run
multiple MySQL @emph{servers} (not clients) on the same data,
or run @code{myisamchk} on the table without first flushing and locking
the @code{mysqld} server tables first.
You can still use @code{LOCK TABLES}/@code{UNLOCK TABLES} even if you
-are using @code{--skip-locking}
+are using @code{--skip-external-locking}
@end itemize
@@ -33832,7 +33842,6 @@ SELECT [STRAIGHT_JOIN]
[FROM table_references
[WHERE where_definition]
[GROUP BY @{unsigned_integer | col_name | formula@} [ASC | DESC], ...
- [WITH @{CUBE | ROLLUP@}] ]
[HAVING where_definition]
[ORDER BY @{unsigned_integer | col_name | formula@} [ASC | DESC] ,...]
[LIMIT [offset,] rows]
@@ -34042,10 +34051,6 @@ read the @code{GROUP BY} description.
@xref{Group by functions}.
@item
-Since Version 3.23.12 MySQL supports @code{CUBE} and @code{ROLLUP}
-clauses. @xref{CUBE and ROLLUP}.
-
-@item
@cindex hints
@code{STRAIGHT_JOIN} forces the optimiser to join the tables in the order in
which they are listed in the @code{FROM} clause. You can use this to speed up
@@ -34154,7 +34159,6 @@ the examined rows will be write locked.
@menu
* JOIN:: @code{JOIN} Syntax
* UNION:: @code{UNION} Syntax
-* CUBE and ROLLUP @code{CUBE} and @code{ROLLUP} Syntax
@end menu
@node JOIN, UNION, SELECT, SELECT
@@ -34319,7 +34323,7 @@ mysql> SELECT * FROM table1 IGNORE INDEX (key3)
@xref{LEFT JOIN optimisation, , @code{LEFT JOIN} optimisation}.
-@node UNION, CUBE and ROLLUP, JOIN, SELECT
+@node UNION, , JOIN, SELECT
@subsubsection @code{UNION} Syntax
@findex UNION
@@ -34337,9 +34341,10 @@ SELECT ...
@code{UNION} is used to combine the result from many @code{SELECT}
statements into one result set.
-The columns listed in the select_expression portion of the @code{SELECT} should
-have the same type. The column names used in the first @code{SELECT} query will be
-used as the column names for the results returned.
+The columns listed in the select_expression portion of the @code{SELECT}
+should have the same type. The column names used in the first
+@code{SELECT} query will be used as the column names for the results
+returned.
The @code{SELECT} commands are normal select commands, but with the following
restrictions:
@@ -34364,141 +34369,6 @@ UNION
ORDER BY a;
@end example
-@node CUBE and ROLLUP, , UNION, SELECT
-@subsubsection @code{CUBE} and @code{ROLLUP} Syntax
-
-Documentation for OLAP extension
-
-Introduction
-------------
-
-MySQL will first support CUBE and ROLLUP operators from entire OLAP
-functionality.
-
-The CUBE and ROLLUP extensions to SQL make querying and reporting
-easier in data warehousing environments. ROLLUP creates subtotals at
-increasing levels of aggregation, from the most detailed up to a grand
-total. CUBE is an extension similar to ROLLUP, enabling a single
-statement to calculate all possible combinations of subtotals.
-
-
-Syntax:
-------
-
-The syntax supported by the enhanced mysql for CUBE and ROLLUP
-operators.
-
-CUBE
-----
-
-SELECT field1, field2, ... AGGR(fieldn) FROM
-table GROUP BY field1, field2 field(n-1) WITH CUBE
-
-This would generate the aggregates with group bys of all the
-combinations of dimensions.
-
-ROLLUP:
------
-
- SELECT field1, field2, ... AGGR(fieldn) FROM table
- GROUP BY field1, field2 field(n-1) WITH ROLLUP
-
-Example:
--------
-
-mysql> select * from sales;
-+------------+---------------+------+--------+
-| product | country | year | profit |
-+------------+---------------+------+--------+
-| Computer | India | 2000 | 1200 |
-| TV | United States | 1999 | 150 |
-| Calculator | United States | 1999 | 50 |
-| Computer | United States | 1999 | 1500 |
-| Computer | United States | 2000 | 1500 |
-| TV | United States | 2000 | 150 |
-| TV | India | 2000 | 100 |
-| TV | India | 2000 | 100 |
-| Calculator | United States | 2000 | 75 |
-| Calculator | India | 2000 | 75 |
-| TV | India | 1999 | 100 |
-| Computer | India | 1999 | 1200 |
-| Computer | United States | 2000 | 1500 |
-| Calculator | United States | 2000 | 75 |
-+------------+---------------+------+--------+
-14 rows in set (0.00 sec)
-
-
-
-mysql> Select sales.product, sales.country , sales.year, sum(profit) from
-sales group by product, country, year with cube;
-
-+------------+---------------+------+-------------+
-| product | country | year | sum(profit) |
-+------------+---------------+------+-------------+
-| Calculator | India | 2000 | 75 |
-| Calculator | United States | 1999 | 50 |
-| Calculator | United States | 2000 | 150 |
-| Computer | India | 1999 | 1200 |
-| Computer | India | 2000 | 1200 |
-| Computer | United States | 1999 | 1500 |
-| Computer | United States | 2000 | 3000 |
-| TV | India | 1999 | 100 |
-| TV | India | 2000 | 200 |
-| TV | United States | 1999 | 150 |
-| TV | United States | 2000 | 150 |
-| ALL | India | 1999 | 1300 |
-| ALL | India | 2000 | 1475 |
-| ALL | United States | 1999 | 1700 |
-| ALL | United States | 2000 | 3300 |
-| Calculator | ALL | 1999 | 50 |
-| Calculator | ALL | 2000 | 225 |
-| Computer | ALL | 1999 | 2700 |
-| Computer | ALL | 2000 | 4200 |
-| TV | ALL | 1999 | 250 |
-| TV | ALL | 2000 | 350 |
-| Calculator | India | 0 | 75 |
-| Calculator | United States | 0 | 200 |
-| Computer | India | 0 | 2400 |
-| Computer | United States | 0 | 4500 |
-| TV | India | 0 | 300 |
-| TV | United States | 0 | 300 |
-| ALL | ALL | 1999 | 3000 |
-| ALL | ALL | 2000 | 4775 |
-| ALL | India | 0 | 2775 |
-| ALL | United States | 0 | 5000 |
-| Calculator | ALL | 0 | 275 |
-| Computer | ALL | 0 | 6900 |
-| TV | ALL | 0 | 600 |
-| ALL | ALL | 0 | 7775 |
-+------------+---------------+------+-------------+
-35 rows in set (0.00 sec)
-
-
-MySQL supports now CUBE and ROLLUP extensions, with all functions
-that one wishes to use with them.
-
-Those extensions already work in all tested combinations. They work
-with UNION's, should work with sub-selects in 4.1 and derived tables.
-
-TODO
-----
-
-For the moment, ORDER and LIMIT are disabled for CUBE and ROLLUP. This
-however remains to be added later.
-
-Another feature that has to be added later is grouping of select list
-itmes in order to alleviate user errors. For the moment, missing
-(hidden) columns are not used at all.
-
-Third feature to be done is to make SQL SET OPTION to set values for
-all values of the column optionally to:
-
-* ALL (as it is now)
-* NULL
-* blank
-
--------------------------------------------------------------------------
-
@findex HANDLER
@node HANDLER, INSERT, SELECT, Data Manipulation
@subsection @code{HANDLER} Syntax
@@ -37781,7 +37651,8 @@ The automatic recovery is activated if you start @code{mysqld} with
@code{--myisam-recover=#}. @xref{Command-line options}.
On open, the table is checked if it's marked as crashed or if the open
count variable for the table is not 0 and you are running with
-@code{--skip-locking}. If either of the above is true the following happens.
+@code{--skip-external-locking}. If either of the above is true the following
+happens.
@itemize @bullet
@item
@@ -47832,7 +47703,7 @@ without locking the table properly.
If you are running many @code{mysqld} servers on the same data on a
system that doesn't support good filesystem locks (normally handled by
the @code{lockd} daemon ) or if you are running
-multiple servers with @code{--skip-locking}
+multiple servers with @code{--skip-external-locking}
@item
You have a crashed index/datafile that contains very wrong data that
got @code{mysqld} confused.
@@ -47901,12 +47772,12 @@ what is happening.
Have you applied the latest patches for your operating system?
@item
-Use the @code{--skip-locking} option to @code{mysqld}. On some systems, the
-@code{lockd} lock manager does not work properly; the @code{--skip-locking}
-option tells @code{mysqld} not to use external locking. (This means that you
-cannot run 2 @code{mysqld} servers on the same data and that you must be
-careful if you use @code{myisamchk}, but it may be instructive to try the
-option as a test.)
+Use the @code{--skip-external-locking} option to @code{mysqld}. On some
+systems, the @code{lockd} lock manager does not work properly; the
+@code{--skip-external-locking} option tells @code{mysqld} not to use external
+locking. (This means that you cannot run 2 @code{mysqld} servers on the same
+data and that you must be careful if you use @code{myisamchk}, but it may be
+instructive to try the option as a test.)
@item
Have you tried @code{mysqladmin -u root processlist} when @code{mysqld}
@@ -50142,6 +50013,14 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
The startup parameters @code{myisam_max_extra_sort_file_size} and
@code{myisam_max_extra_sort_file_size} are now given in bytes, not megabytes.
@item
+External system locking of MyISAM/ISAM files is now turned off by default.
+One can turn this one by doing @code{--external-locking}. (For most users
+this is never needed).
+@item
+Fixed core dump bug with @code{INSERT ... SET db_name.table_name.colname=''}.
+@item
+Fixed client hangup bug when using some SQL commands with wrong syntax.
+@item
Fixed a timing bug in @code{DROP DATABASE}
@item
New @code{SET [GLOBAL | SESSION]} syntax to change thread specific and global
@@ -50155,14 +50034,14 @@ Renamed variable @code{query_cache_startup_type} to @code{query_cache_type},
Renamed some sql variables, but old names will still work until 5.0.
@xref{Upgrading-from-3.23}.
@item
+Renamed @code{--skip-locking} to @code{--skip-external-locking}.
+@item
Removed not used variable @code{query_buffer_size}.
@item
Fixed a bug that made the pager option in the @code{mysql} client
non-functional.
@item
Added full @code{AUTO_INCREMENT} support to @code{MERGE} tables.
-@item
-Added support for @code{CUBE} and @code{ROLLUP}.
@end itemize
@node News-4.0.2, News-4.0.1, News-4.0.3, News-4.0.x
@@ -50179,6 +50058,7 @@ Don't allow database names that contain @samp{\}.
@item
Added @code{XOR} operator (logical and bitwise @code{XOR}) with @code{^}
as a synonym for bitwise @code{XOR}.
+@item
Added function @code{IS_FREE_LOCK("lock_name")}.
Based on code contributed by Hartmut Holzgraefe @email{hartmut@@six.de}.
@item
@@ -54493,7 +54373,7 @@ Added optimisation to remove const reference tables from @code{ORDER BY} and
@item
@code{mysqld} now automatically disables system locking on Linux and Windows,
and for systems that use MIT-pthreads. You can force the use of locking
-with the @code{--enable-locking} option.
+with the @code{--enable-external-locking} option.
@item
Added @code{--console} option to @code{mysqld}, to force a console window
(for error messages) when using Windows.
@@ -54794,7 +54674,7 @@ index file and cause error 126 or 138.
@item
Fixed fatal bug in @code{refresh()} when running with the
-@code{--skip-locking} option. There was a ``very small'' time gap after
+@code{--skip-external-locking} option. There was a ``very small'' time gap after
a @code{mysqladmin refresh} when a table could be corrupted if one
thread updated a table while another thread did @code{mysqladmin
refresh} and another thread started a new update ont the same table
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index dafee798416..9f0ea9d7988 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -250,4 +250,6 @@
#define ER_WRONG_VALUE_FOR_VAR 1231
#define ER_WRONG_TYPE_FOR_VAR 1232
#define ER_VAR_CANT_BE_READ 1233
-#define ER_ERROR_MESSAGES 234
+#define ER_CANT_USE_OPTION_HERE 1234
+#define ER_NOT_SUPPORTED_YET 1235
+#define ER_ERROR_MESSAGES 236
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index 8ebc5c33555..031d5e847e8 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -181,7 +181,8 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
return;
}
-static int _ftb_no_dupes_cmp(void* not_used, const void *a,const void *b)
+static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)),
+ const void *a,const void *b)
{
return CMP_NUM((*((my_off_t*)a)), (*((my_off_t*)b)));
}
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 4727a3ab303..91990dc3b66 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -840,7 +840,9 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
}
if (info->s->base.blobs)
{
- if (!(to=mi_fix_rec_buff_for_blob(info,block_info.rec_len)))
+ if (!(to= mi_alloc_rec_buff(info, block_info.rec_len,
+ &info->rec_buff,
+ &info->alloced_rec_buff_length)))
{
mi_check_print_error(param,"Not enough memory for blob at %s",
llstr(start_recpos,llbuff));
@@ -2791,8 +2793,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
if (share->base.blobs)
{
if (!(to=mi_alloc_rec_buff(info,block_info.rec_len,
- &(sort_param->rec_buff),
- &(sort_param->alloced_rec_buff_length))))
+ &(sort_param->rec_buff),
+ &(sort_param->alloced_rec_buff_length))))
{
mi_check_print_error(param,"Not enough memory for blob at %s",
llstr(sort_param->start_recpos,llbuff));
diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c
index 92c8e50690b..4ef4f80d137 100644
--- a/myisam/mi_dynrec.c
+++ b/myisam/mi_dynrec.c
@@ -60,10 +60,10 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
int error;
ulong reclength,extra;
- extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
- MI_DYN_DELETE_BLOCK_HEADER+1;
- reclength=info->s->base.pack_reclength+
- _my_calc_total_blob_length(info,record)+ extra;
+ extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
+ MI_DYN_DELETE_BLOCK_HEADER+1);
+ reclength= (info->s->base.pack_reclength+
+ _my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH)
{
@@ -91,10 +91,10 @@ int _mi_update_blob_record(MI_INFO *info, my_off_t pos, const byte *record)
int error;
ulong reclength,extra;
- extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
- MI_DYN_DELETE_BLOCK_HEADER;
- reclength=info->s->base.pack_reclength+
- _my_calc_total_blob_length(info,record)+ extra;
+ extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
+ MI_DYN_DELETE_BLOCK_HEADER);
+ reclength= (info->s->base.pack_reclength+
+ _my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH)
{
@@ -1059,7 +1059,9 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
goto panic;
if (info->s->base.blobs)
{
- if (!(to=mi_fix_rec_buff_for_blob(info,block_info.rec_len)))
+ if (!(to=mi_alloc_rec_buff(info, block_info.rec_len,
+ &info->rec_buff,
+ &info->alloced_rec_buff_length)))
goto err;
}
else
@@ -1328,7 +1330,9 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
info->lastpos=filepos;
if (share->base.blobs)
{
- if (!(to=mi_fix_rec_buff_for_blob(info,block_info.rec_len)))
+ if (!(to= mi_alloc_rec_buff(info, block_info.rec_len,
+ &info->rec_buff,
+ &info->alloced_rec_buff_length)))
goto err;
}
else
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index 6c658a33dda..8ac65975a5c 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -344,7 +344,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
}
if (share->base.blobs)
- mi_fix_rec_buff_for_blob(info, -1);
+ mi_alloc_rec_buff(info, -1, &info->rec_buff,
+ &info->alloced_rec_buff_length);
break;
case HA_EXTRA_NORMAL: /* Theese isn't in use */
info->quick_mode=0;
diff --git a/myisam/mi_key.c b/myisam/mi_key.c
index 6ec8668ab61..3cee1f301e1 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -250,7 +250,9 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
if (info->blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY)
{
if (!(blob_ptr=
- mi_fix_rec_buff_for_blob(info, info->s->keyinfo[keynr].keylength)))
+ mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength,
+ &info->rec_buff,
+ &info->alloced_rec_buff_length)))
goto err;
}
key=(byte*) info->lastkey;
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index e10d931e6d3..feed8f29df8 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -507,7 +507,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
/* Allocate buffer for one record */
/* prerequisites: bzero(info) && info->s=share; are met. */
- if (!mi_fix_rec_buff_for_blob(&info, -1))
+ if (!mi_alloc_rec_buff(&info, -1, &info.rec_buff,
+ &info.alloced_rec_buff_length))
goto err;
bzero(info.rec_buff, info.alloced_rec_buff_length);
@@ -559,6 +560,7 @@ err:
DBUG_RETURN (NULL);
} /* mi_open */
+
gptr mi_get_rec_buff_ptr(MI_INFO *info, byte *buf)
{
if (info->s->options & HA_OPTION_PACK_RECORD && buf)
@@ -567,6 +569,7 @@ gptr mi_get_rec_buff_ptr(MI_INFO *info, byte *buf)
return buf;
}
+
byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf, uint *buf_len)
{
uint extra;
@@ -576,23 +579,24 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf, uint *buf_len)
byte *newptr = *buf;
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
- if (length == (ulong)-1)
- length=max(info->s->base.pack_reclength,info->s->base.max_key_length);
+ if (length == (ulong) -1)
+ length= max(info->s->base.pack_reclength,info->s->base.max_key_length);
extra= ((info->s->options & HA_OPTION_PACK_RECORD) ?
- ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
- MI_REC_BUFF_OFFSET : 0);
+ ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
+ MI_REC_BUFF_OFFSET : 0);
if (extra && newptr)
newptr-=MI_REC_BUFF_OFFSET;
if (!(newptr=(byte*) my_realloc((gptr)newptr, length+extra+8,
MYF(MY_ALLOW_ZERO_PTR))))
return 0;
- *buf=newptr+(extra ? MI_REC_BUFF_OFFSET : 0);
- *buf_len=length;
+ *buf= newptr+(extra ? MI_REC_BUFF_OFFSET : 0);
+ *buf_len= length;
}
return *buf;
}
+
ulonglong mi_safe_mul(ulonglong a, ulonglong b)
{
ulonglong max_val= ~ (ulonglong) 0; /* my_off_t is unsigned */
diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c
index d067fdc0fc5..07abde07644 100644
--- a/myisam/mi_packrec.c
+++ b/myisam/mi_packrec.c
@@ -1057,7 +1057,9 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
info->blob_len=uint3korr(header+head_length+1);
head_length+=4;
}
- if (!(mi_fix_rec_buff_for_blob(myisam,info->rec_len + info->blob_len)))
+ if (!(mi_alloc_rec_buff(myisam,info->rec_len + info->blob_len,
+ &myisam->rec_buff,
+ &myisam->alloced_rec_buff_length)))
return BLOCK_FATAL_ERROR; /* not enough memory */
myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff+info->rec_len;
myisam->blob_length=info->blob_len;
@@ -1231,8 +1233,10 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam,MI_BLOCK_INFO *info,
info->blob_len=uint3korr(header+1);
header+=4;
}
- /* mi_fix_rec_buff_for_blob sets my_errno on error */
- if (!(mi_fix_rec_buff_for_blob(myisam,info->blob_len)))
+ /* mi_alloc_rec_buff sets my_errno on error */
+ if (!(mi_alloc_rec_buff(myisam, info->blob_len,
+ &myisam->rec_buff,
+ &myisam->alloced_rec_buff_length)))
return 0; /* not enough memory */
myisam->bit_buff.blob_pos=(uchar*) myisam->rec_buff;
}
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 8c1ca393a3c..73b9a1280a4 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -525,9 +525,6 @@ extern int _mi_read_cache(IO_CACHE *info,byte *buff,my_off_t pos,
extern void update_auto_increment(MI_INFO *info,const byte *record);
extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**, uint*);
extern gptr mi_get_rec_buff_ptr(MI_INFO *, byte *);
-#define mi_fix_rec_buff_for_blob(INFO,LENGTH) \
- mi_alloc_rec_buff((INFO),(LENGTH), \
- &((INFO)->rec_buff), &((INFO)->alloced_rec_buff_length))
extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from,
ulong reclength);
extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos);
diff --git a/myisam/sort.c b/myisam/sort.c
index faac75ea120..79d31147bfc 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -283,7 +283,7 @@ pthread_handler_decl(thr_find_all_keys,arg)
int error;
uint memavl,old_memavl,keys,sort_length;
uint idx, maxbuffer;
- uchar **sort_keys;
+ uchar **sort_keys=0;
error=1;
diff --git a/mysql-test/r/insert_set.result b/mysql-test/r/insert_set.result
index 438c2c95147..d95765c6472 100644
--- a/mysql-test/r/insert_set.result
+++ b/mysql-test/r/insert_set.result
@@ -1,6 +1,6 @@
-drop database if exists a;
-create database a;
-use a;
+drop database if exists foo;
+create database foo;
+use foo;
create table b (c int);
-insert into a.b set a.b.c = '1';
-drop database a;
+insert into foo.b set foo.b.c = '1';
+drop database foo;
diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result
index 0842b038235..fa6008e99f7 100644
--- a/mysql-test/r/olap.result
+++ b/mysql-test/r/olap.result
@@ -15,124 +15,13 @@ insert into sales values ( 'Computer', 'India',2000, 1200),
( 'Computer', 'United States', 2000,1500),
( 'Calculator', 'United States', 2000,75);
select product, country , year, sum(profit) from sales group by product, country, year with cube;
-product country year sum(profit)
-Calculator India 2000 75
-Calculator United States 1999 50
-Calculator United States 2000 150
-Computer India 1999 1200
-Computer India 2000 1200
-Computer United States 1999 1500
-Computer United States 2000 3000
-TV India 1999 100
-TV India 2000 200
-TV United States 1999 150
-TV United States 2000 150
-Calculator India 0 75
-Calculator United States 0 200
-Computer India 0 2400
-Computer United States 0 4500
-TV India 0 300
-TV United States 0 300
-Calculator ALL 1999 50
-Calculator ALL 2000 225
-Computer ALL 1999 2700
-Computer ALL 2000 4200
-TV ALL 1999 250
-TV ALL 2000 350
-ALL India 1999 1300
-ALL India 2000 1475
-ALL United States 1999 1700
-ALL United States 2000 3300
-Calculator ALL 0 275
-Computer ALL 0 6900
-TV ALL 0 600
-ALL India 0 2775
-ALL United States 0 5000
-ALL ALL 1999 3000
-ALL ALL 2000 4775
-ALL ALL 0 7775
+This version of MySQL doesn't yet support 'CUBE',
explain select product, country , year, sum(profit) from sales group by product, country, year with cube;
-table type possible_keys key key_len ref rows Extra
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14
+This version of MySQL doesn't yet support 'CUBE',
select product, country , year, sum(profit) from sales group by product, country, year with rollup;
-product country year sum(profit)
-Calculator India 2000 75
-Calculator United States 1999 50
-Calculator United States 2000 150
-Computer India 1999 1200
-Computer India 2000 1200
-Computer United States 1999 1500
-Computer United States 2000 3000
-TV India 1999 100
-TV India 2000 200
-TV United States 1999 150
-TV United States 2000 150
-ALL India 1999 1300
-ALL India 2000 1475
-ALL United States 1999 1700
-ALL United States 2000 3300
-ALL ALL 1999 3000
-ALL ALL 2000 4775
-ALL ALL 0 7775
+This version of MySQL doesn't yet support 'ROLLUP',
explain select product, country , year, sum(profit) from sales group by product, country, year with rollup;
-table type possible_keys key key_len ref rows Extra
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14 Using temporary; Using filesort
-sales ALL NULL NULL NULL NULL 14
+This version of MySQL doesn't yet support 'ROLLUP',
select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup;
-product country year sum(profit)
-Calculator India 2000 75
-Calculator United States 1999 50
-Calculator United States 2000 150
-Computer India 1999 1200
-Computer India 2000 1200
-Computer United States 1999 1500
-Computer United States 2000 3000
-TV India 1999 100
-TV India 2000 200
-TV United States 1999 150
-TV United States 2000 150
-Calculator India 0 75
-Calculator United States 0 200
-Computer India 0 2400
-Computer United States 0 4500
-TV India 0 300
-TV United States 0 300
-Calculator ALL 1999 50
-Calculator ALL 2000 225
-Computer ALL 1999 2700
-Computer ALL 2000 4200
-TV ALL 1999 250
-TV ALL 2000 350
-ALL India 1999 1300
-ALL India 2000 1475
-ALL United States 1999 1700
-ALL United States 2000 3300
-Calculator ALL 0 275
-Computer ALL 0 6900
-TV ALL 0 600
-ALL India 0 2775
-ALL United States 0 5000
-ALL ALL 1999 3000
-ALL ALL 2000 4775
-ALL ALL 0 7775
-Calculator India 2000 75
-Calculator United States 1999 50
-Calculator United States 2000 150
-Computer India 1999 1200
-Computer India 2000 1200
-Computer United States 1999 1500
-Computer United States 2000 3000
-TV India 1999 100
-TV India 2000 200
-TV United States 1999 150
-TV United States 2000 150
+This version of MySQL doesn't yet support 'CUBE',
drop table sales;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 52f4d4a14f6..896901dd8af 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -129,6 +129,8 @@ select * from t1 union select a from t2;
The used SELECT statements have a different number of columns
select a from t1 union select * from t2;
The used SELECT statements have a different number of columns
+select * from t1 union select SQL_BUFFER_RESULT * from t2;
+Wrong usage/placement of 'SQL_BUFFER_RESULT'
create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2;
replace into t3 select a,b as c from t1 union all select a,b from t2;
diff --git a/mysql-test/t/insert_set.test b/mysql-test/t/insert_set.test
index 41d20eaefdb..2f7e8408ea3 100644
--- a/mysql-test/t/insert_set.test
+++ b/mysql-test/t/insert_set.test
@@ -2,9 +2,9 @@
# Test of mysqld crash with fully qualified column names
#
-drop database if exists a;
-create database a;
-use a;
+drop database if exists foo;
+create database foo;
+use foo;
create table b (c int);
-insert into a.b set a.b.c = '1';
-drop database a;
+insert into foo.b set foo.b.c = '1';
+drop database foo;
diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test
index b91bf2fb193..8fe547db615 100644
--- a/mysql-test/t/olap.test
+++ b/mysql-test/t/olap.test
@@ -14,9 +14,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200),
( 'Computer', 'India', 1999,1200),
( 'Computer', 'United States', 2000,1500),
( 'Calculator', 'United States', 2000,75);
+--error 1235
select product, country , year, sum(profit) from sales group by product, country, year with cube;
+--error 1235
explain select product, country , year, sum(profit) from sales group by product, country, year with cube;
+--error 1235
select product, country , year, sum(profit) from sales group by product, country, year with rollup;
+--error 1235
explain select product, country , year, sum(profit) from sales group by product, country, year with rollup;
+--error 1235
select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup;
drop table sales;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index d13b5dec662..6e6b43ebe3b 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -23,7 +23,11 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
select found_rows();
+
+#
# Test some error conditions with UNION
+#
+
explain select a,b from t1 union all select a,b from t2;
--error 1054
@@ -53,6 +57,9 @@ select * from t1 union select a from t2;
--error 1222
select a from t1 union select * from t2;
+--error 1234
+select * from t1 union select SQL_BUFFER_RESULT * from t2;
+
# Test CREATE, INSERT and REPLACE
create table t3 select a,b from t1 union all select a,b from t2;
insert into t3 select a,b from t1 union all select a,b from t2;
diff --git a/sql/item.h b/sql/item.h
index b31f6cf053a..a7ea48a45aa 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -82,7 +82,7 @@ public:
virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime);
virtual bool is_null() { return 0; }
- virtual unsigned int size_of () =0;
+ virtual unsigned int size_of()= 0;
};
@@ -97,7 +97,7 @@ public:
:db_name(db_name_par),table_name(table_name_par),field_name(field_name_par)
{ name = (char*) field_name_par; }
const char *full_name() const;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -138,7 +138,7 @@ public:
bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime);
bool is_null() { return field->is_null(); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -160,7 +160,7 @@ public:
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_null(name); }
bool is_null() { return 1; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -190,7 +190,7 @@ public:
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_int(name,value,max_length); }
void print(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -205,7 +205,7 @@ public:
void make_field(Send_field *field);
Item *new_item() { return new Item_uint(name,max_length); }
void print(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -236,7 +236,7 @@ public:
void make_field(Send_field *field);
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_real(name,value,decimals,max_length); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -248,7 +248,7 @@ public:
decimals=NOT_FIXED_DEC;
max_length=DBL_DIG+8;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_string :public Item
@@ -282,7 +282,7 @@ public:
String *const_string() { return &str_value; }
inline void append(char *str,uint length) { str_value.append(str,length); }
void print(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/* for show tables */
@@ -293,7 +293,7 @@ public:
Item_datetime(const char *item_name): Item_string(item_name,"",0)
{ max_length=19;}
void make_field(Send_field *field);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_empty_string :public Item_string
@@ -301,7 +301,7 @@ class Item_empty_string :public Item_string
public:
Item_empty_string(const char *header,uint length) :Item_string("",0)
{ name=(char*) header; max_length=length;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_varbinary :public Item
@@ -316,7 +316,7 @@ public:
bool save_in_field(Field *field);
void make_field(Send_field *field);
enum Item_result result_type () const { return INT_RESULT; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -329,7 +329,7 @@ public:
Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; }
table_map used_tables() const { return 1; }
virtual void fix_length_and_dec()=0;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -379,7 +379,7 @@ public:
void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); }
enum Item_result result_type () const { return (*ref)->result_type(); }
table_map used_tables() const { return (*ref)->used_tables(); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -399,7 +399,7 @@ public:
{
return ref->save_in_field(field);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -434,7 +434,7 @@ public:
table_map used_tables() const { return (table_map) 1L; }
bool const_item() const { return 0; }
bool is_null() { return null_value; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -445,7 +445,7 @@ public:
Item_buff() :null_value(0) {}
virtual bool cmp(void)=0;
virtual ~Item_buff(); /*line -e1509 */
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_str_buff :public Item_buff
@@ -456,7 +456,7 @@ public:
Item_str_buff(Item *arg) :item(arg),value(arg->max_length) {}
bool cmp(void);
~Item_str_buff(); // Deallocate String:s
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -467,7 +467,7 @@ class Item_real_buff :public Item_buff
public:
Item_real_buff(Item *item_par) :item(item_par),value(0.0) {}
bool cmp(void);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_int_buff :public Item_buff
@@ -477,7 +477,7 @@ class Item_int_buff :public Item_buff
public:
Item_int_buff(Item *item_par) :item(item_par),value(0) {}
bool cmp(void);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -494,7 +494,7 @@ public:
buff= (char*) sql_calloc(length=field->pack_length());
}
bool cmp(void);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
extern Item_buff *new_Item_buff(Item *item);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 8cda0302af5..9d83a8a9673 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -28,7 +28,7 @@ public:
Item_bool_func(Item *a) :Item_int_func(a) {}
Item_bool_func(Item *a,Item *b) :Item_int_func(a,b) {}
void fix_length_and_dec() { decimals=0; max_length=1; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_bool_func2 :public Item_int_func
@@ -48,7 +48,7 @@ public:
bool have_rev_func() const { return rev_functype() != UNKNOWN_FUNC; }
void print(String *str) { Item_func::print_op(str); }
bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -82,7 +82,7 @@ public:
enum Functype rev_functype() const { return EQUAL_FUNC; }
cond_result eq_cmp_result() const { return COND_TRUE; }
const char *func_name() const { return "<=>"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -188,7 +188,7 @@ public:
~Item_func_interval() { delete item; }
const char *func_name() const { return "interval"; }
void update_used_tables();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -203,7 +203,7 @@ public:
enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec();
const char *func_name() const { return "ifnull"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -218,7 +218,7 @@ public:
enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec();
const char *func_name() const { return "if"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -233,7 +233,7 @@ public:
enum Item_result result_type () const { return cached_result_type; }
void fix_length_and_dec();
const char *func_name() const { return "nullif"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -248,7 +248,7 @@ public:
void fix_length_and_dec();
enum Item_result result_type () const { return cached_result_type; }
const char *func_name() const { return "coalesce"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_case :public Item_func
@@ -269,7 +269,7 @@ public:
void print(String *str);
bool fix_fields(THD *thd,struct st_table_list *tlist);
Item *find_item(String *str);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -431,7 +431,7 @@ class Item_func_in :public Item_int_func
enum Functype functype() const { return IN_FUNC; }
const char *func_name() const { return " IN "; }
void update_used_tables();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -469,7 +469,7 @@ public:
}
}
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_isnotnull :public Item_bool_func
@@ -484,7 +484,7 @@ public:
}
const char *func_name() const { return "isnotnull"; }
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_like :public Item_bool_func2
@@ -518,7 +518,7 @@ public:
const char *func_name() const { return "like"; }
void fix_length_and_dec();
bool fix_fields(THD *thd,struct st_table_list *tlist);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
#ifdef USE_REGEX
@@ -538,7 +538,7 @@ public:
longlong val_int();
bool fix_fields(THD *thd,struct st_table_list *tlist);
const char *func_name() const { return "regex"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
#else
@@ -575,7 +575,7 @@ public:
void print(String *str);
void split_sum_func(List<Item> &fields);
friend int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_func.h b/sql/item_func.h
index 6ecbc04ddf0..846d99a29d2 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -121,7 +121,7 @@ public:
}
bool is_null() { (void) val_int(); return null_value; }
friend class udf_handler;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -141,7 +141,7 @@ public:
if (!t_arg) return result_field;
return new Field_double(max_length, maybe_null, name,t_arg,decimals);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_num_func :public Item_func
@@ -156,7 +156,7 @@ public:
enum Item_result result_type () const { return hybrid_type; }
void fix_length_and_dec() { fix_num_length_and_dec(); }
bool is_null() { (void) val(); return null_value; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -190,7 +190,7 @@ class Item_num_op :public Item_func
res= new Field_double(max_length, maybe_null, name, t_arg, decimals);
return res;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -463,7 +463,7 @@ public:
const char *func_name() const { return truncate ? "truncate" : "round"; }
double val();
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -499,7 +499,7 @@ class Item_func_units :public Item_real_func
double val();
const char *func_name() const { return name; }
void fix_length_and_dec() { decimals=NOT_FIXED_DEC; max_length=float_length(decimals); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -516,7 +516,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
enum Item_result result_type () const { return cmp_type; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_min :public Item_func_min_max
@@ -542,7 +542,7 @@ public:
longlong val_int();
const char *func_name() const { return "length"; }
void fix_length_and_dec() { max_length=10; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_bit_length :public Item_func_length
@@ -561,7 +561,7 @@ public:
longlong val_int();
const char *func_name() const { return "char_length"; }
void fix_length_and_dec() { max_length=10; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_locate :public Item_int_func
@@ -573,7 +573,7 @@ public:
const char *func_name() const { return "locate"; }
longlong val_int();
void fix_length_and_dec() { maybe_null=0; max_length=11; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -603,7 +603,7 @@ public:
const_item_cache&= item->const_item();
with_sum_func= with_sum_func || item->with_sum_func;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -615,7 +615,7 @@ public:
longlong val_int();
const char *func_name() const { return "ascii"; }
void fix_length_and_dec() { max_length=3; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_ord :public Item_int_func
@@ -625,7 +625,7 @@ public:
Item_func_ord(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "ord"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_find_in_set :public Item_int_func
@@ -638,7 +638,7 @@ public:
longlong val_int();
const char *func_name() const { return "find_in_set"; }
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -714,7 +714,7 @@ class Item_func_benchmark :public Item_int_func
longlong val_int();
const char *func_name() const { return "benchmark"; }
void fix_length_and_dec() { max_length=1; maybe_null=0; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -739,7 +739,7 @@ public:
return res;
}
Item_result result_type () const { return udf.result_type(); }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -848,7 +848,7 @@ class Item_func_get_lock :public Item_int_func
longlong val_int();
const char *func_name() const { return "get_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_release_lock :public Item_int_func
@@ -859,7 +859,7 @@ class Item_func_release_lock :public Item_int_func
longlong val_int();
const char *func_name() const { return "release_lock"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/* replication functions */
@@ -872,7 +872,7 @@ class Item_master_pos_wait :public Item_int_func
longlong val_int();
const char *func_name() const { return "master_pos_wait"; }
void fix_length_and_dec() { max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -898,7 +898,7 @@ public:
void fix_length_and_dec();
void print(String *str);
const char *func_name() const { return "set_user_var"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -923,7 +923,7 @@ public:
table_map used_tables() const
{ return const_var_flag ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const;
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -979,7 +979,7 @@ public:
bool fix_index();
void init_search(bool no_order);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -1030,5 +1030,5 @@ public:
longlong val_int();
const char *func_name() const { return "check_lock"; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index efff9d93941..482bf499757 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -40,7 +40,7 @@ public:
if (!t_arg) return result_field;
return (max_length > 255) ? (Field *)new Field_blob(max_length,maybe_null, name,t_arg, binary) : (Field *) new Field_string(max_length,maybe_null, name,t_arg, binary);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_md5 :public Item_str_func
@@ -51,7 +51,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "md5"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_sha :public Item_str_func
@@ -91,7 +91,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "concat"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_concat_ws :public Item_str_func
@@ -112,7 +112,7 @@ public:
|| Item_func::fix_fields(thd,tlist));
}
const char *func_name() const { return "concat_ws"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_reverse :public Item_str_func
@@ -133,7 +133,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "replace"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -146,7 +146,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "insert"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -193,7 +193,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "right"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -206,7 +206,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "substr"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -218,7 +218,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "substr_index"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -230,7 +230,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "ltrim"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -242,7 +242,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "rtrim"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_trim :public Item_str_func
@@ -253,7 +253,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length= args[0]->max_length; }
const char *func_name() const { return "trim"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -265,7 +265,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { max_length = 16; }
const char *func_name() const { return "password"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_des_encrypt :public Item_str_func
@@ -278,7 +278,7 @@ public:
void fix_length_and_dec()
{ maybe_null=1; max_length = args[0]->max_length+8; }
const char *func_name() const { return "des_encrypt"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_des_decrypt :public Item_str_func
@@ -290,7 +290,7 @@ public:
String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = args[0]->max_length; }
const char *func_name() const { return "des_decrypt"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_encrypt :public Item_str_func
@@ -301,7 +301,7 @@ public:
Item_func_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
String *val_str(String *);
void fix_length_and_dec() { maybe_null=1; max_length = 13; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
#include "sql_crypt.h"
@@ -315,7 +315,7 @@ public:
Item_str_func(a),sql_crypt(seed) {}
String *val_str(String *);
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_decode :public Item_func_encode
@@ -353,7 +353,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "soundex"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -374,7 +374,7 @@ public:
void fix_length_and_dec();
void update_used_tables();
const char *func_name() const { return "elt"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -394,7 +394,7 @@ public:
void fix_length_and_dec();
void update_used_tables();
const char *func_name() const { return "make_set"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -409,7 +409,7 @@ public:
max_length=args[0]->max_length+(args[0]->max_length-args[0]->decimals)/3;
}
const char *func_name() const { return "format"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -431,7 +431,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "repeat"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -444,7 +444,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "rpad"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -457,7 +457,7 @@ public:
String *val_str(String *);
void fix_length_and_dec();
const char *func_name() const { return "lpad"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -479,7 +479,7 @@ public:
const char *func_name() const { return "hex"; }
String *val_str(String *);
void fix_length_and_dec() { decimals=0; max_length=args[0]->max_length*2; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -504,7 +504,7 @@ public:
const char *func_name() const { return "load_file"; }
void fix_length_and_dec()
{ binary=1; maybe_null=1; max_length=MAX_BLOB_WIDTH;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 8326114629b..2cf92343ebb 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -70,7 +70,7 @@ public:
void print(String *str);
void fix_num_length_and_dec();
virtual bool setup(THD *thd) {return 0;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -85,7 +85,7 @@ public:
longlong val_int() { return (longlong) val(); } /* Real as default */
String *val_str(String*str);
void reset_field();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -100,7 +100,7 @@ public:
double val() { return (double) val_int(); }
String *val_str(String*str);
enum Item_result result_type () const { return INT_RESULT; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -118,7 +118,7 @@ class Item_sum_sum :public Item_sum_num
void reset_field();
void update_field(int offset);
const char *func_name() const { return "sum"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -141,7 +141,7 @@ class Item_sum_count :public Item_sum_int
void reset_field();
void update_field(int offset);
const char *func_name() const { return "count"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -193,7 +193,7 @@ class Item_sum_count_distinct :public Item_sum_int
void update_field(int offset) { return ; } // Never called
const char *func_name() const { return "count_distinct"; }
bool setup(THD *thd);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -213,7 +213,7 @@ public:
String *val_str(String*);
void make_field(Send_field *field);
void fix_length_and_dec() {}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -235,7 +235,7 @@ class Item_sum_avg :public Item_sum_num
Item *result_item(Field *field)
{ return new Item_avg_field(this); }
const char *func_name() const { return "avg"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_sum_std;
@@ -252,7 +252,7 @@ public:
bool is_null() { (void) val_int(); return null_value; }
void make_field(Send_field *field);
void fix_length_and_dec() {}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_sum_std :public Item_sum_num
@@ -273,7 +273,7 @@ class Item_sum_std :public Item_sum_num
Item *result_item(Field *field)
{ return new Item_std_field(this); }
const char *func_name() const { return "std"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -316,7 +316,7 @@ class Item_sum_hybrid :public Item_sum
void min_max_update_str_field(int offset);
void min_max_update_real_field(int offset);
void min_max_update_int_field(int offset);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -328,7 +328,7 @@ public:
bool add();
const char *func_name() const { return "min"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -340,7 +340,7 @@ public:
bool add();
const char *func_name() const { return "max"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -356,7 +356,7 @@ class Item_sum_bit :public Item_sum_int
void reset();
longlong val_int();
void reset_field();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -367,7 +367,7 @@ class Item_sum_or :public Item_sum_bit
bool add();
void update_field(int offset);
const char *func_name() const { return "bit_or"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -378,7 +378,7 @@ class Item_sum_and :public Item_sum_bit
bool add();
void update_field(int offset);
const char *func_name() const { return "bit_and"; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/*
@@ -409,7 +409,7 @@ public:
bool add();
void reset_field() {};
void update_field(int offset_arg) {};
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 08fbfe25093..6b0d1850d8c 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -175,7 +175,7 @@ public:
const char *func_name() const { return "weekday"; }
enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_func_dayname :public Item_func_weekday
@@ -201,7 +201,7 @@ public:
{
decimals=0; max_length=10;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -240,7 +240,7 @@ public:
if (!t_arg) return result_field;
return new Field_date(maybe_null, name, t_arg);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -259,7 +259,7 @@ public:
if (!t_arg) return result_field;
return new Field_datetime(maybe_null, name, t_arg);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -287,7 +287,7 @@ public:
if (!t_arg) return result_field;
return new Field_time(maybe_null, name, t_arg);
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -301,7 +301,7 @@ public:
const char *func_name() const { return "curdate"; }
void fix_length_and_dec(); /* Retrieves curtime */
bool get_date(TIME *res,bool fuzzy_date);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -323,7 +323,7 @@ public:
const char *func_name() const { return "now"; }
void fix_length_and_dec();
bool get_date(TIME *res,bool fuzzy_date);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -348,7 +348,7 @@ public:
const char *func_name() const { return "date_format"; }
void fix_length_and_dec();
uint format_length(const String *format);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -408,7 +408,7 @@ public:
double val() { return (double) val_int(); }
longlong val_int();
bool get_date(TIME *res,bool fuzzy_date);
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_extract :public Item_int_func
@@ -422,7 +422,7 @@ class Item_extract :public Item_int_func
longlong val_int();
const char *func_name() const { return "extract"; }
void fix_length_and_dec();
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_typecast :public Item_str_func
diff --git a/sql/item_uniq.h b/sql/item_uniq.h
index 18f5e5ca45e..cc087832f49 100644
--- a/sql/item_uniq.h
+++ b/sql/item_uniq.h
@@ -29,7 +29,7 @@ public:
:Item_real_func(list) {}
double val() { return 0.0; }
void fix_length_and_dec() { decimals=0; max_length=6; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_sum_unique_users :public Item_sum_num
@@ -44,5 +44,5 @@ public:
void reset_field() {}
void update_field(int offset) {}
bool fix_fields(THD *thd,struct st_table_list *tlist) { return 0;}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 78db1ba2699..6dc70d0a86c 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -337,6 +337,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
+bool check_simple_select();
/* net_pkg.c */
void send_warning(NET *net, uint sql_errno, const char *err=0);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c1d9f215da0..6c520ffe9ed 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -256,7 +256,7 @@ ulong back_log, connect_timeout;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30];
bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
bool opt_disable_networking=0, opt_skip_show_db=0;
-my_bool opt_local_infile;
+my_bool opt_local_infile, opt_external_locking;
static bool opt_do_pstack = 0;
static ulong opt_specialflag=SPECIAL_ENGLISH;
@@ -2928,8 +2928,10 @@ struct my_option my_long_options[] =
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE,
"Don't flush key buffers between writes for any MyISAM table", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"enable-locking", OPT_ENABLE_LOCK, "Enable system locking", 0, 0, 0,
- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"enable-locking", OPT_ENABLE_LOCK,
+ "Depricated option, use --external-locking instead",
+ (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__
{"enable-named-pipe", OPT_HAVE_NAMED_PIPE, "Enable the named pipe (NT)",
(gptr*) &opt_enable_named_pipe, (gptr*) &opt_enable_named_pipe, 0, GET_BOOL,
@@ -3198,7 +3200,7 @@ struct my_option my_long_options[] =
{"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK,
- "Don't use system locking. To use isamchk one has to shut down the server.",
+ "Depricated option, use --skip-external-locking instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -3257,8 +3259,9 @@ struct my_option my_long_options[] =
"Default transaction isolation level", 0, 0, 0, GET_NO_ARG, REQUIRED_ARG, 0,
0, 0, 0,
0, 0},
- {"use-locking", OPT_USE_LOCKING, "Use system (external) locking",
- 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"external-locking", OPT_USE_LOCKING, "Use system (external) locking. With this option enabled you can run myisamchk to test (not repair) tables while the MySQL server is running",
+ (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef USE_SYMDIR
{"use-symbolic-links", 's', "Enable symbolic link support",
(gptr*) &my_use_symdir, (gptr*) &my_use_symdir, 0, GET_BOOL, NO_ARG, 0, 0,
@@ -3835,9 +3838,8 @@ static void set_options(void)
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
#endif
-#if defined( HAVE_mit_thread ) || defined( __WIN__ ) || defined( HAVE_LINUXTHREADS )
my_disable_locking=myisam_single_user= 1;
-#endif
+ opt_external_locking=0;
my_bind_addr = htonl( INADDR_ANY );
}
@@ -4060,17 +4062,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_specialflag|= SPECIAL_NO_PRIOR;
break;
case (int) OPT_SKIP_LOCK:
- my_disable_locking=myisam_single_user= 1;
+ opt_external_locking=0;
break;
case (int) OPT_SKIP_HOST_CACHE:
opt_specialflag|= SPECIAL_NO_HOST_CACHE;
break;
- case (int) OPT_ENABLE_LOCK:
- my_disable_locking=myisam_single_user=0;
- break;
- case (int) OPT_USE_LOCKING:
- my_disable_locking=0;
- break;
case (int) OPT_SKIP_RESOLVE:
opt_specialflag|=SPECIAL_NO_RESOLVE;
break;
@@ -4323,6 +4319,7 @@ static void get_options(int argc,char **argv)
Set some global variables from the global_system_variables
In most cases the global variables will not be used
*/
+ my_disable_locking= myisam_single_user= test(opt_external_locking == 0);
my_default_record_cache_size=global_system_variables.read_buff_size;
myisam_max_temp_length=
(my_off_t) min(global_system_variables.myisam_max_sort_file_size,
diff --git a/sql/procedure.h b/sql/procedure.h
index d2600a62e62..349908a8d84 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -43,7 +43,7 @@ public:
{
init_make_field(tmp_field,field_type());
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_proc_real :public Item_proc
@@ -63,7 +63,7 @@ public:
double val() { return value; }
longlong val_int() { return (longlong) value; }
String *val_str(String *s) { s->set(value,decimals); return s; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
class Item_proc_int :public Item_proc
@@ -81,7 +81,7 @@ public:
double val() { return (double) value; }
longlong val_int() { return value; }
String *val_str(String *s) { s->set(value); return s; }
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
@@ -101,7 +101,7 @@ public:
{
return null_value ? (String*) 0 : (String*) &str_value;
}
- virtual unsigned int size_of () { return sizeof(*this);}
+ unsigned int size_of() { return sizeof(*this);}
};
/* The procedure class definitions */
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 1ec59c55b1b..ec8a9e83ed3 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -475,7 +475,7 @@ struct show_var_st init_vars[]= {
{sys_safe_show_db.name, (char*) &sys_safe_show_db, SHOW_SYS},
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
- {"skip_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
+ {"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
{sys_slow_launch_time.name, (char*) &sys_slow_launch_time, SHOW_SYS},
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index f5695a1aeb6..18b4c3ad2a8 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -244,3 +244,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index f758f3c6c4c..7d409e3133f 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 3081968c537..4a674999c82 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -244,3 +244,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 0e480d795c3..04150b67084 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 603560e31ed..2a0233ca949 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -240,3 +240,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 807312b41a2..42f83e6eed2 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index 5c0f222bb1b..0cd3f8cd902 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index 404a9ea5c1d..bed0afe8286 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index 658f1161843..a3c4f945351 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 52915d6c143..39c9635cc91 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index 958c04e3d75..f146f03e687 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index ba5e5023a17..c3ab3d5d680 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index e205cae60d1..a0191ba86d7 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 4d650b1c439..8d87c00e1b3 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -237,3 +237,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 9ee380b0ab9..def94b8795a 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -239,3 +239,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 3906e638ba2..868bb42b6be 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index ffde33c0e1d..fd12a1f3a64 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -239,3 +239,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index fa03d28ee32..dfe3b4a2f92 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -238,3 +238,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index cb5f62302b6..8e9433396fc 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -243,3 +243,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 1b0fbc87241..57314579c63 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -236,3 +236,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index fb948a01083..7a4d17cfdfa 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -235,3 +235,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt
index 2e7560ed618..d8d9349b56a 100644
--- a/sql/share/ukrainian/errmsg.txt
+++ b/sql/share/ukrainian/errmsg.txt
@@ -240,3 +240,5 @@
"Variable '%-.64s' can't be set to the value of '%-.64s'",
"Wrong argument type to variable '%-.64s'",
"Variable '%-.64s' can only be set, not read",
+"Wrong usage/placement of '%s'",
+"This version of MySQL doesn't yet support '%s',"
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index f4538fefbea..29cc925218f 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1608,7 +1608,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
for (; tables ; tables=tables->next)
{
if (!strcmp(tables->name,table_name) &&
- (!db || !tables->db || !strcmp(db,tables->db)))
+ (!db || !strcmp(db,tables->db)))
{
found_table=1;
Field *find=find_field_in_table(thd,tables->table,name,length,
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 53388220924..4cc9dc550c8 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -73,6 +73,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
}
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
+ table_list.db= table->table_cache_key;
table_list.name=table->table_name;
table_list.table=table;
table_list.grant=table->grant;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 0fb9b77e79e..9c1e017a4f6 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -97,7 +97,7 @@ enum sub_select_type
enum olap_type
{
- NON_EXISTING_ONE, CUBE_TYPE, ROLLUP_TYPE
+ UNSPECIFIED_OLAP_TYPE, CUBE_TYPE, ROLLUP_TYPE
};
/* The state of the lex parsing for selects */
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
index d05e891db63..fa4d23805f4 100644
--- a/sql/sql_olap.cc
+++ b/sql/sql_olap.cc
@@ -15,7 +15,18 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-/* OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com> */
+/*
+ OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com>
+ Inspired by code submitted by Srilakshmi <lakshmi@gdit.iiit.net>
+
+ The ROLLUP code in this file has to be complitely rewritten as it's
+ not good enough to satisfy the goals of MySQL.
+
+ In 4.1 we will replace this with a working, superior implementation
+ of ROLLUP.
+*/
+
+#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
#ifdef __GNUC__
#pragma implementation // gcc: Class implementation
@@ -179,3 +190,5 @@ int handle_olaps(LEX *lex, SELECT_LEX *select_lex)
sl_return=1; // impossible
return sl_return;
}
+
+#endif /* DISABLED_UNTIL_REWRITTEN_IN_4_1 */
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 515886a4b2d..33229b4cb4c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2684,6 +2684,7 @@ mysql_init_query(THD *thd)
thd->lex.select_lex.table_list.next= (byte**) &thd->lex.select_lex.table_list.first;
thd->lex.select_lex.next=0;
thd->lex.olap=0;
+ thd->lex.select->olap= UNSPECIFIED_OLAP_TYPE;
thd->fatal_error=0; // Safety
thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0;
thd->sent_row_count=thd->examined_row_count=0;
@@ -2700,7 +2701,7 @@ mysql_init_select(LEX *lex)
select_lex->offset_limit=0;
select_lex->options=0;
select_lex->linkage=UNSPECIFIED_TYPE;
- select_lex->olap= NON_EXISTING_ONE;
+ select_lex->olap= UNSPECIFIED_OLAP_TYPE;
lex->exchange = 0;
lex->proc_list.first=0;
select_lex->order_list.elements=select_lex->group_list.elements=0;
@@ -2767,7 +2768,11 @@ mysql_parse(THD *thd,char *inBuf,uint length)
}
}
else
+ {
+ DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
+ thd->fatal_error));
query_cache_abort(&thd->net);
+ }
thd->proc_info="freeing items";
free_items(thd); /* Free strings used by items */
lex_end(lex);
@@ -3441,3 +3446,28 @@ static bool append_file_to_dir(THD *thd, char **filename_ptr, char *table_name)
strxmov(ptr,buff,table_name,NullS);
return 0;
}
+
+/*
+ Check if the select is a simple select (not an union)
+
+ SYNOPSIS
+ check_simple_select()
+
+ RETURN VALUES
+ 0 ok
+ 1 error ; In this case the error messege is sent to the client
+*/
+
+bool check_simple_select()
+{
+ THD *thd= current_thd;
+ if (thd->lex.select != &thd->lex.select_lex)
+ {
+ char command[80];
+ strmake(command, thd->lex.yylval->symbol.str,
+ min(thd->lex.yylval->symbol.length, sizeof(command)-1));
+ net_printf(&thd->net, ER_CANT_USE_OPTION_HERE, command);
+ return 1;
+ }
+ return 0;
+}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f9cbab64aad..2f12d7d1012 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -146,7 +146,7 @@ static bool update_sum_func(Item_sum **func);
static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
bool distinct, const char *message=NullS);
static void describe_info(JOIN *join, const char *info);
-extern int handle_olaps(LEX *lex, SELECT_LEX *select);
+
/*
This handles SELECT with and without UNION
*/
@@ -155,23 +155,26 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
{
int res;
register SELECT_LEX *select_lex = &lex->select_lex;
+
+#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
if (lex->olap)
{
- SELECT_LEX *sl, *last_sl;
- int returned;
- for (sl= &lex->select_lex;sl;sl=sl->next)
+ SELECT_LEX *sl, *sl_next;
+ int error;
+ for (sl= &select_lex; sl; sl=sl_next)
{
- if (sl->olap != NON_EXISTING_ONE)
+ sl_next=sl->next; // Save if sl->next changes
+ if (sl->olap != UNSPECIFIED_OLAP_TYPE)
{
- last_sl=sl->next;
- if ((returned=handle_olaps(lex,sl)))
- return returned;
- lex->last_selects->next=sl=last_sl;
- if (!sl) break;
+ if ((error=handle_olaps(lex,sl)))
+ return error;
+ lex->last_selects->next=sl_next;
}
}
lex->select = select_lex;
}
+#endif DISABLED_UNTIL_REWRITTEN_IN_4_1
+
if (select_lex->next)
res=mysql_union(thd,lex,result);
else
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 88d2f7a1d25..aeedfeb148b 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -50,7 +50,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
cursor;
cursor=cursor->next)
{
- if (cursor->do_redirect)
+ if (cursor->do_redirect) // False if CUBE/ROLLUP
{
cursor->table= ((TABLE_LIST*) cursor->table)->table;
cursor->do_redirect=false;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 767a2f67afb..1288f03155e 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1435,22 +1435,51 @@ select_option_list:
select_option:
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
- | HIGH_PRIORITY { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_HIGH_PRIORITY; }
+ | HIGH_PRIORITY
+ {
+ if (check_simple_select())
+ YYABORT;
+ Lex->lock_option= TL_READ_HIGH_PRIORITY;
+ }
| DISTINCT { Select->options|= SELECT_DISTINCT; }
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
- | SQL_BUFFER_RESULT { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_BUFFER_RESULT; }
- | SQL_CALC_FOUND_ROWS { if (Select != &Lex->select_lex) YYABORT; Select->options|= OPTION_FOUND_ROWS; }
- | SQL_NO_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; current_thd->safe_to_cache_query=0; }
- | SQL_CACHE_SYM { if (Select != &Lex->select_lex) YYABORT; Select->options |= OPTION_TO_QUERY_CACHE; }
- | ALL {};
+ | SQL_BUFFER_RESULT
+ {
+ if (check_simple_select())
+ YYABORT;
+ Select->options|= OPTION_BUFFER_RESULT;
+ }
+ | SQL_CALC_FOUND_ROWS
+ {
+ if (check_simple_select())
+ YYABORT;
+ Select->options|= OPTION_FOUND_ROWS;
+ }
+ | SQL_NO_CACHE_SYM { current_thd->safe_to_cache_query=0; }
+ | SQL_CACHE_SYM { Select->options|= OPTION_TO_QUERY_CACHE; }
+ | ALL {}
+ ;
select_lock_type:
/* empty */
| FOR_SYM UPDATE_SYM
- { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; }
+ {
+ LEX *lex=Lex;
+ if (check_simple_select())
+ YYABORT;
+ lex->lock_option= TL_WRITE;
+ lex->thd->safe_to_cache_query=0;
+ }
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
- { if (Select != &Lex->select_lex) YYABORT; Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; };
+ {
+ LEX *lex=Lex;
+ if (check_simple_select())
+ YYABORT;
+ lex->lock_option= TL_READ_WITH_SHARED_LOCKS;
+ lex->thd->safe_to_cache_query=0;
+ }
+ ;
select_item_list:
select_item_list ',' select_item
@@ -2047,7 +2076,8 @@ join_table:
{
SELECT_LEX *sel=Select;
if (!($$=add_table_to_list($2,$3,0,TL_UNLOCK, sel->use_index_ptr,
- sel->ignore_index_ptr))) YYABORT;
+ sel->ignore_index_ptr)))
+ YYABORT;
}
| '{' ident join_table LEFT OUTER JOIN_SYM join_table ON expr '}'
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; };
@@ -2158,14 +2188,21 @@ olap_opt:
/* empty */ {}
| WITH CUBE_SYM
{
- Lex->olap = true;
- Select->olap= CUBE_TYPE;
+ LEX *lex=Lex;
+ lex->olap = true;
+ lex->select->olap= CUBE_TYPE;
+ net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "CUBE");
+ YYABORT; /* To be deleted in 4.1 */
}
| WITH ROLLUP_SYM
{
- Lex->olap = true;
- Select->olap= ROLLUP_TYPE;
+ LEX *lex=Lex;
+ lex->olap = true;
+ lex->select->olap= ROLLUP_TYPE;
+ net_printf(&lex->thd->net, ER_NOT_SUPPORTED_YET, "ROLLUP");
+ YYABORT; /* To be deleted in 4.1 */
}
+ ;
/*
Order by statement in select
@@ -2180,9 +2217,17 @@ order_clause:
{
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "UPDATE", "ORDER BY");
YYABORT;
- if (lex->olap)
- YYABORT;
+ }
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE,
+ "CUBE/ROLLUP",
+ "ORDER BY");
+ YYABORT;
+ }
lex->select->sort_default=1;
} order_list;
@@ -2203,8 +2248,12 @@ limit_clause:
| LIMIT ULONG_NUM
{
LEX *lex=Lex;
- if (lex->olap)
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
+ "LIMIT");
YYABORT;
+ }
SELECT_LEX *sel=Select;
sel->select_limit= $2;
sel->offset_limit= 0L;
@@ -2212,9 +2261,13 @@ limit_clause:
| LIMIT ULONG_NUM ',' ULONG_NUM
{
LEX *lex=Lex;
- if (lex->olap)
+ if (lex->select->olap != UNSPECIFIED_OLAP_TYPE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "CUBE/ROLLUP",
+ "LIMIT");
YYABORT;
- SELECT_LEX *sel=Select;
+ }
+ SELECT_LEX *sel=lex->select;
sel->select_limit= $4;
sel->offset_limit= $2;
};
@@ -2224,7 +2277,10 @@ delete_limit_clause:
{
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE)
+ {
+ net_printf(&lex->thd->net, ER_WRONG_USAGE, "DELETE", "LIMIT");
YYABORT;
+ }
lex->select->select_limit= HA_POS_ERROR;
}
| LIMIT ulonglong_num
@@ -3475,8 +3531,8 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements)
{
- send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
- YYABORT;
+ send_error(&lex->thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
+ YYABORT;
}
}
| ident '.' '*'
@@ -3514,8 +3570,13 @@ opt_table:
user_list:
- grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
- | user_list ',' grant_user { if (Lex->users_list.push_back($3)) YYABORT;};
+ grant_user { if (Lex->users_list.push_back($1)) YYABORT;}
+ | user_list ',' grant_user
+ {
+ if (Lex->users_list.push_back($3))
+ YYABORT;
+ }
+ ;
grant_user:
@@ -3631,42 +3692,55 @@ rollback:
union:
- /* empty */ {}
- | union_list;
+ /* empty */ {}
+ | union_list;
union_list:
- UNION_SYM union_option
- {
- LEX *lex=Lex;
- if (lex->exchange)
- {
- /* Only the last SELECT can have INTO...... */
- net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO");
- YYABORT;
- }
- if (lex->select->linkage == NOT_A_SELECT || mysql_new_select(lex))
- YYABORT;
- lex->select->linkage=UNION_TYPE;
- }
- select_init;
+ UNION_SYM union_option
+ {
+ LEX *lex=Lex;
+ if (lex->exchange)
+ {
+ /* Only the last SELECT can have INTO...... */
+ net_printf(&lex->thd->net, ER_WRONG_USAGE,"UNION","INTO");
+ YYABORT;
+ }
+ if (lex->select->linkage == NOT_A_SELECT)
+ {
+ send_error(&lex->thd->net, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
+ if (mysql_new_select(lex))
+ YYABORT;
+ lex->select->linkage=UNION_TYPE;
+ }
+ select_init
+ ;
union_opt:
- union {}
- | optional_order_or_limit {};
+ union {}
+ | optional_order_or_limit {};
optional_order_or_limit:
- /* empty */ {}
- |
- {
- LEX *lex=Lex;
- if (!lex->select->braces || mysql_new_select(lex))
- YYABORT;
- mysql_init_select(lex);
- lex->select->linkage=NOT_A_SELECT;
- lex->select->select_limit=lex->thd->variables.select_limit;
- }
- opt_order_clause limit_clause;
+ /* empty */ {}
+ |
+ {
+ LEX *lex=Lex;
+ if (!lex->select->braces)
+ {
+ send_error(&lex->thd->net, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
+ if (mysql_new_select(lex))
+ YYABORT;
+ mysql_init_select(lex);
+ lex->select->linkage=NOT_A_SELECT;
+ lex->select->select_limit=lex->thd->variables.select_limit;
+ }
+ opt_order_clause limit_clause
+ ;
union_option:
- /* empty */ {}
- | ALL {Lex->union_option=1;};
+ /* empty */ {}
+ | ALL { Lex->union_option=1; }
+ ;