Commit graph

56 commits

Author SHA1 Message Date
msvensson@neptunus.(none)
2036bdc88e Move test that requires innodb to "mysql_innodb" 2006-09-01 16:51:37 +02:00
evgen@sunlight.local
dda7a95c59 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  sunlight.local:/local_work/tmp_merge-5.1-opt-mysql
2006-08-01 09:24:19 +04:00
sergefp@mysql.com
699291a8e6 BUG#14940 "MySQL choose wrong index", v.2
- Make the range-et-al optimizer produce E(#table records after table 
                                           condition is applied),
- Make the join optimizer use this value,
- Add "filtered" column to EXPLAIN EXTENDED to show 
  fraction of records left after table condition is applied
- Adjust test results, add comments
2006-07-28 21:27:01 +04:00
kostja@bodhi.local
99fefab169 Merge bodhi.local:/opt/local/work/tmp_merge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge-5.0
2006-07-13 11:43:52 +04:00
guilhem@gbichot3.local
0594e1b84b WL#3146 "less locking in auto_increment":
this is a cleanup patch for our current auto_increment handling:
new names for auto_increment variables in THD, new methods to manipulate them
(see sql_class.h), some move into handler::, causing less backup/restore
work when executing substatements. 
This makes the logic hopefully clearer, less work is is needed in
mysql_insert().
By cleaning up, using different variables for different purposes (instead
of one for 3 things...), we fix those bugs, which someone may want to fix
in 5.0 too:
BUG#20339 "stored procedure using LAST_INSERT_ID() does not replicate
statement-based"
BUG#20341 "stored function inserting into one auto_increment puts bad
data in slave"
BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY UPDATE"
(now if a row is updated, LAST_INSERT_ID() will return its id)
and re-fixes:
BUG#6880 "LAST_INSERT_ID() value changes during multi-row INSERT"
(already fixed differently by Ramil in 4.1)
Test of documented behaviour of mysql_insert_id() (there was no test).
The behaviour changes introduced are:
- LAST_INSERT_ID() now returns "the first autogenerated auto_increment value
successfully inserted", instead of "the first autogenerated auto_increment
value if any row was successfully inserted", see auto_increment.test.
Same for mysql_insert_id(), see mysql_client_test.c.
- LAST_INSERT_ID() returns the id of the updated row if ON DUPLICATE KEY
UPDATE, see auto_increment.test. Same for mysql_insert_id(), see
mysql_client_test.c.
- LAST_INSERT_ID() does not change if no autogenerated value was successfully 
inserted (it used to then be 0), see auto_increment.test.
- if in INSERT SELECT no autogenerated value was successfully inserted,
mysql_insert_id() now returns the id of the last inserted row (it already
did this for INSERT VALUES), see mysql_client_test.c.
- if INSERT SELECT uses LAST_INSERT_ID(X), mysql_insert_id() now returns X
(it already did this for INSERT VALUES), see mysql_client_test.c.
- NDB now behaves like other engines wrt SET INSERT_ID: with INSERT IGNORE,
the id passed in SET INSERT_ID is re-used until a row succeeds; SET INSERT_ID
influences not only the first row now.

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

Finally we prepare for engines capable of reserving finite-length intervals
of auto_increment values: we store such intervals in THD. The next step
(to be done by the replication team in 5.1) is to read those intervals from
THD and actually store them in the statement-based binary log. NDB
will be a good engine to test that.
2006-07-09 17:52:19 +02:00
kroki@mysql.com
08f192f81b Bug#17203: "sql_no_cache sql_cache" in views created from prepared statement
The problem was that we restored SQL_CACHE, SQL_NO_CACHE flags in SELECT
statement from internal structures based on value set later at runtime, not
the original value set by the user.

The solution is to remember that original value.
2006-06-27 21:28:32 +04:00
evgen@moonbone.local
79c91f6214 Manually merged 2006-06-18 14:56:35 +04:00
ramil@mysql.com
c15a5a2b26 Merge mysql.com:/usr/home/ram/work/mysql-4.1
into  mysql.com:/usr/home/ram/work/mysql-5.0
2006-06-15 17:37:47 +05:00
ramil@mysql.com
0bdae38efb Fix for bug #6880: LAST_INSERT_ID() within a statement 2006-06-07 14:01:10 +05:00
holyfoot@deer.(none)
f002088b7f test result fixed 2006-05-18 12:42:38 +05:00
holyfoot@deer.(none)
034508f6ca bug #14573 (Error on adding auto_increment on to a column with '0' values) 2006-05-12 18:02:42 +05:00
msvensson@neptunus.(none)
6420483d6b Update test results for 5.1 2006-05-10 20:39:26 +02:00
msvensson@neptunus.(none)
4736d8d53c Merge neptunus.(none):/home/msvensson/mysql/tmp/tmp_merge
into  neptunus.(none):/home/msvensson/mysql/mysql-5.1
2006-05-10 15:49:33 +02:00
jani@ua141d10.elisa.omakaista.fi
0410832526 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-4.1
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
2006-05-04 18:35:58 +03:00
tnurnberg@mysql.com
5becb110e0 Bug#19025 4.1 mysqldump doesn't correctly dump "auto_increment = [int]"
mysqldump / SHOW CREATE TABLE will show the NEXT available value for
the PK, rather than the *first* one that was available (that named in
the original CREATE TABLE ... AUTO_INCREMENT = ... statement).

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

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

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

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

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

Confirmed by support as likely solution for client's problem.
2006-05-04 03:12:51 +02:00
ingo@mysql.com
b6e28c99d0 WL#1563 - Modify MySQL to support fast CREATE/DROP INDEX
Change "duplicate key" message to print key name
instead of key number.
2006-01-23 12:17:05 +01:00
gluh@eagle.intranet.mysql.r18.ru
e9d70e4b97 Fix for bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-issue more correct message for incorrect date|datetime|time values
  -ER_WARN_DATA_OUT_OF_RANGE message is changed
  -added new error message
2005-12-02 15:01:44 +04:00
gluh@eagle.intranet.mysql.r18.ru
21cc3ae561 Fix for bug#11491 Misleading error message if not NULL column set to NULL,
SQL mode TRADITIONAL
  Message is chenged from 'ER_WARN_NULL_TO_NOTNULL' to 'ER_BAD_NULL_ERROR'
2005-12-01 15:30:11 +04:00
monty@mysql.com
dec2607e1d Ensure that we reset auto-increment cache if we have to do an UPDATE becasue of REPLACE
This fixes bug #11080: Multi-row REPLACE fails on a duplicate key error
2005-06-06 20:41:52 +03:00
monty@mysql.com
9db45adb60 Merge with 4.1 2005-05-14 18:31:22 +03:00
monty@mysql.com
b4e92e6360 Merge with 4.0 2005-05-14 00:01:40 +03:00
monty@mysql.com
9b39f8304e Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045) 2005-05-13 23:08:29 +03:00
monty@mysql.com
afbe601302 merge with 4.1 2004-10-29 19:26:52 +03:00
dlenev@brandersnatch.localdomain
1f54900630 Fix for bug #5915 "ALTER TABLE behaves differently when converting column
to auto_increment in 4.1".
Now we are enforcing NO_AUTO_VALUE_ON_ZERO mode during ALTER TABLE only
if we are converting one auto_increment column to another auto_increment
column (this also includes most common case when we don't do anything
with such column).

Also now when we convert some column to TIMESTAMP NOT NULL column with
ALTER TABLE we convert NULL values to current timestamp, (as we do this
in INSERT). One can still get old behavior by setting system TIMESTAMP
variable to 0.
2004-10-07 13:02:39 +04:00
monty@mishka.local
be4ca46fbe More fixes for strict mode:
More tests.
Better error messages.
Fixed bug when checking if we updated all needed columns for INSERT.
Give an error if we encounter a wrong float value during parsing.
Don't print DEFAULT for columns without a default value in SHOW CREATE/SHOW FIELDS.
Fixed UPDATE IGNORE when using STRICT mode.
2004-10-02 22:20:08 +03:00
monty@mishka.local
f2941380c4 Strict mode & better warnings
Under strict mode MySQL will generate an error message if there was any conversion when assigning data to a field.
Added checking of date/datetime fields.
If strict mode, give error if we have not given value to field without a default value (for INSERT)
2004-09-28 20:08:00 +03:00
serg@serg.mylan
c5e2fbcc53 no_auto_value_on_zero + alter table bug 2004-07-30 14:17:12 +02:00
serg@serg.mylan
3a17ab4551 auto_value_on_zero bug test 2004-07-30 09:47:56 +02:00
bar@mysql.com
51e08a7c49 auto_increment.test, auto_increment.result:
Drop t2 in the beginning.
  ,
2004-06-22 14:10:50 +05:00
paul@ice.snake.net
fd1d01e098 Language/consistency edits to error messages
and affected test results.
2004-06-15 22:18:20 -05:00
bell@sanja.is.com.ua
4c774e0c18 fixed flags of printed query 2004-05-13 23:47:20 +03:00
pem@mysql.comhem.se
6395822932 Fixed BUG#3117: LAST_INSERT_ID() works incorrectly inside stored procedure.
This turned out to be a problem for prepared statements as well; the id was
evaluated once, at parse time.
2004-03-25 17:42:13 +01:00
monty@mysql.com
f43093ec0e After merge fixes
Added more DBUG statements
Ensure that we are comparing end space with BINARY strings
Use 'any_db' instead of '' to mean any database. (For HANDLER command)
Only strip ' ' when comparing CHAR, not other space-like characters (like \t)
2004-02-16 10:03:25 +02:00
monty@mysql.com
7dfcc949d6 after merge fixes 2003-12-19 17:15:54 +02:00
monty@mysql.com
d4c32db181 merge with 4.0.18 2003-12-19 16:42:17 +02:00
monty@mysql.com
031390a9a4 Fixes after merge with 4.0
Cleaned up embedded library access and query cache handling
Changed min stack size to 128K (to allow longer MyISAM keys)
Fixed wrong priority for XOR (should be less than NEG to get -1^1 to work)
2003-12-19 16:25:50 +02:00
monty@mysql.com
1f997d4a70 Removed compiler warning
Fixed not updated test from last changeset
2003-12-18 15:24:21 +02:00
monty@mysql.com
e0cc6799ec Merge with 4.0.17 2003-12-17 17:35:34 +02:00
monty@mysql.com
f995a5f4aa Fix autoincrement for signed columns (Bug #1366)
Fixed problem with char > 128 in QUOTE() function. (Bug #1868)
Disable creation of symlinks if my_disable_symlink is set
Fixed searching of TEXT with end space. (Bug #1651)
Fixed caching bug in multi-table-update where same table was used twice. (Bug #1711)
Fixed problem with UNIX_TIMESTAMP() for timestamps close to 0. (Bug #1998)
Fixed timestamp.test
2003-12-12 22:26:58 +02:00
antony@ltantony.rdg.cyberkinetica.homeunix.net
fcf96dbb18 WorkLog#1323
Deprecate the use of TYPE=... Preferred syntax is ENGINE=
2003-12-10 04:31:42 +00:00
bell@sanja.is.com.ua
33346e26af added code covarage for functions convert(), nullif(), crc32(), is_used_lock(), char_lengtrh(), bit_xor()
added string length for more speed
made code covarage for print() method of Item
fixed printability of some items (SCRUM) (WL#1274)
2003-10-30 12:57:26 +02:00
monty@mashka.mysql.fi
4f7512160b After merge fixes
Use server character set if --default-character-set is not used
Added convert_string() for more efficient alloc+character-set convert of strings
2003-08-19 00:08:08 +03:00
vva@eagle.mysql.r18.ru
406b8ba21e changed for AUTO_VALUE_ON_ZERO 2003-07-28 10:57:46 -04:00
vva@eagle.mysql.r18.ru
f32299279d fixed bug 663 and WL 1052 (sql_mode is safe for mysqldump) 2003-07-22 18:58:30 -04:00
monty@mashka.mysql.fi
6bc7b3a6be LAST_INSERT_ID() should not be set if we couldn't generate an auto_increment id. 2003-06-30 13:28:36 +03:00
monty@narttu.mysql.fi
d33cb08eb6 LAST_INSERT_ID()}will now return 0 if the last INSERT didn't insert any rows. 2003-06-15 12:34:04 +03:00
monty@narttu.mysql.fi
23145cfed7 Added SQLSTATE to client/server protocol
bmove_allign -> bmove_align
Added OLAP function ROLLUP
Split mysql_fix_privilege_tables to a script and a .sql data file
Added new (MEMROOT*) functions to avoid calling current_thd() when creating some common objects.
Added table_alias_charset, for easier --lower-case-table-name handling
Better SQL_MODE handling (Setting complex options also sets sub options)
New (faster) assembler string functions for x86
2003-06-04 18:28:51 +03:00
venu@myvenu.com
72196c9b16 Updated warning test
Updated all tests to catchup warnings for all field conversions
2003-04-30 00:07:37 -07:00
serg@sergbook.mysql.com
91d6ec3438 don't increment LAST_INSERT_ID() when incremented value cannot be stored in auto_increment column (e.g. is too big) 2003-03-31 23:14:26 +04:00
serg@serg.mysql.com
be580475be fix auto-increment in sub-key and insert ... select 2003-03-02 01:48:57 +01:00