Commit graph

93 commits

Author SHA1 Message Date
evgen@moonbone.local
4fa7ee92e6 Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
command and reported to a client.

The fact that a timestamp field will be set to NO on UPDATE wasn't shown 
by the SHOW COMMAND and reported to a client through connectors. This led to
problems in the ODBC connector and might lead to a user confusion.

A new filed flag called ON_UPDATE_NOW_FLAG is added. 
Constructors of the Field_timestamp set it when a field should be set to NOW
on UPDATE.

The get_schema_column_record function now reports whether a timestamp field
will be set to NOW on UPDATE.
2007-11-13 13:24:48 +00:00
gkodinov/kgeorge@magare.gmz
7f8c4aacf6 Merge magare.gmz:/home/kgeorge/mysql/work/B31221-5.0-gca-opt
into  magare.gmz:/home/kgeorge/mysql/work/B31221-5.1-opt
2007-10-18 15:57:59 +03:00
gkodinov/kgeorge@magare.gmz
d67cd9e8af Bug #31221: Optimizer incorrectly identifies impossible WHERE clause
No warning was generated when a TIMESTAMP with a non-zero time part
 was converted to a DATE value. This caused index lookup to assume
 that this is a valid conversion and was returning rows that match 
 a comparison between a TIMESTAMP value and a DATE keypart.
 Fixed by generating a warning on such a truncation.
2007-10-18 15:19:04 +03:00
kostja@bodhi.(none)
7ce3cada45 Merge bodhi.(none):/opt/local/work/mysql-5.0-runtime
into  bodhi.(none):/opt/local/work/mysql-5.1-runtime
2007-07-02 01:55:01 +04:00
anozdrin/alik@ibm.
6eb17c289a Follow up to the patch for the BUG#10491. 2007-06-29 17:37:17 +04:00
igor@olga.mysql.com
31c57a1efc Post-merge fix. 2007-06-04 03:03:15 -07:00
gluh@mysql.com/eagle.(none)
cdbdc4e745 backport of Bug#11491 Misleading error message if not NULL column set to NULL, SQL mode TRADITIONAL 2007-05-30 17:04:04 +05:00
ibabaev@bk-internal.mysql.com
040e46fc1c Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into  bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
2007-05-28 00:05:38 +02:00
holyfoot/hf@mysql.com/hfmain.(none)
b96e1df90c Bug #28361 Buffer overflow in DECIMAL code on Windows
result max length changed for the 'decimal' fields
so test results have to be fixed
2007-05-21 13:02:03 +05:00
thek@adventure.(none)
637f85ca21 Bug#26277 User variable returns one type in SELECT @v and other for CREATE as SELECT @v
- Adding variable m_cached_result_type to keep the variable type consistent
  during the execution of a statement.
- Before each result set is returned to the client the description of each
  column is sent as meta data.
  Previously the result type for a column could change if the hash variable
  entry changed between statements. This caused the result set of the query
  to alternate column types in certain cases which is not supported by MySQL
  client-server protocol. Example:
  Previously this sequence:
    SET @a:=1;
    SELECT @a:="text", @a;
  would return "text", "text";
 
  After the change the SELECT returns "text", 0
  The reson for this is that previously the result set from 'SELECT @a;'
  would always be of the type STRING, whereas now the type of the variable
  is taken from the last SET statement. However, 'SELECT @a:="text"' will
  return type of STRING since the right side of the assignment is used.
2007-05-18 12:44:03 +02:00
msvensson@pilot.blaudden
a65d12a830 Backport of TIME->MYSQL_TIME / Y2K fixset
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
2007-05-16 10:44:59 +02:00
holyfoot/hf@hfmain.(none)
2fcebef31f Merge mysql.com:/d2/hf/mrg/mysql-5.0-opt
into  mysql.com:/d2/hf/mrg/mysql-5.1-opt
2007-04-29 13:19:32 +05:00
evgen@moonbone.local
4747fa0c03 Bug#27590: Wrong DATE/DATETIME comparison.
DATE and DATETIME can be compared either as strings or as int. Both
methods have their disadvantages. Strings can contain valid DATETIME value
but have insignificant zeros omitted thus became non-comparable with
other DATETIME strings. The comparison as int usually will require conversion
from the string representation and the automatic conversion in most cases is
carried out in a wrong way thus producing wrong comparison result. Another
problem occurs when one tries to compare DATE field with a DATETIME constant.
The constant is converted to DATE losing its precision i.e. losing time part.

This fix addresses the problems described above by adding a special
DATE/DATETIME comparator. The comparator correctly converts DATE/DATETIME
string values to int when it's necessary, adds zero time part (00:00:00)
to DATE values to compare them correctly to DATETIME values. Due to correct
conversion malformed DATETIME string values are correctly compared to other
DATE/DATETIME values.

As of this patch a DATE value equals to DATETIME value with zero time part.
For example '2001-01-01' equals to '2001-01-01 00:00:00'.

The compare_datetime() function is added to the Arg_comparator class.
It implements the correct comparator for DATE/DATETIME values.
Two supplementary functions called get_date_from_str() and get_datetime_value()
are added. The first one extracts DATE/DATETIME value from a string and the
second one retrieves the correct DATE/DATETIME value from an item.
The new Arg_comparator::can_compare_as_dates() function is added and used
to check whether two given items can be compared by the compare_datetime()
comparator.
Two caching variables were added to the Arg_comparator class to speedup the
DATE/DATETIME comparison.
One more store() method was added to the Item_cache_int class to cache int
values.
The new is_datetime() function was added to the Item class. It indicates
whether the item returns a DATE/DATETIME value.
2007-04-27 00:12:09 +04:00
monty@mysql.com/narttu.mysql.fi
1933603647 Removed not used define YY_MAGIC_BELOW
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME

Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
2007-03-23 22:08:31 +02:00
tnurnberg@sin.intern.azundris.com
36a5e0b3df Merge mysql.com:/home/tnurnberg/21103/50-21103
into  mysql.com:/home/tnurnberg/21103/51-21103
2007-03-02 15:25:06 +01:00
tnurnberg@mysql.com/sin.intern.azundris.com
f37267bb3c Bug #21103: DATE column not compared as DATE
If we compare two items A and B, with B being (a constant) of a
larger type, then A gets promoted to B's type for comparison if
it's a constant, function, or CAST() column, but B gets demoted
to A's type if A is a (not explicitly CAST()) column. This is
counter-intuitive and not mandated by the standard.
 
Disabling optimisation where it would be lossy so field value
will properly get promoted and compared as binary string (rather
than as integers).
2007-03-02 15:23:13 +01:00
bar@mysql.com/bar.intranet.mysql.r18.ru
9c53c7ffb1 Automerge fix: "Out of range value" error message adjusted to 5.1. 2006-10-03 18:48:50 +05:00
bar@bar.intranet.mysql.r18.ru
3cfbe36adc After merge fix 2006-10-03 16:00:09 +05:00
bar@mysql.com/bar.intranet.mysql.r18.ru
07f9efd1e1 Merge mysql.com:/usr/home/bar/mysql-5.0.b6147v2
into  mysql.com:/usr/home/bar/mysql-5.0.b6147rpl
2006-09-29 16:40:18 +05:00
jani/jamppa@production.mysql.com
201b810cf4 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  production.mysql.com:/usersnfs/jamppa/mysql-5.1-bug-20208
2006-09-25 08:10:58 +02:00
jani@ua141d10.elisa.omakaista.fi
0fb727866f Fixed result file. Blob width 8192 changed to 16777216. 2006-09-22 16:35:52 +03:00
acurtis/antony@xiphis.org/ltantony.xiphis.org
e2d4aa2ca4 Merge xiphis.org:/home/antony/work2/mysql-5.0-engines
into  xiphis.org:/home/antony/work2/mysql-5.0-merge
2006-08-14 21:27:36 -07:00
svoj@may.pils.ru
6c6f435b03 BUG#14770 - LOAD DATA INFILE doesn't respect default values for
columns
Fixed confusing warning.

Quoting INSERT section of the manual:
----
Inserting NULL into a column that has been declared NOT NULL. For
multiple-row INSERT statements or INSERT INTO ... SELECT statements, the
column is set to the implicit default value for the column data type. This
is 0 for numeric types, the empty string ('') for string types, and the
"zero" value for date and time types. INSERT INTO ... SELECT statements are
handled the same way as multiple-row inserts because the server does not
examine the result set from the SELECT to see whether it returns a single
row. (For a single-row INSERT, no warning occurs when NULL is inserted into
a NOT NULL column. Instead, the statement fails with an error.)
----
This is also true for LOAD DATA INFILE. For INSERT user can specify
DEFAULT keyword as a value to set column default. There is no similiar
feature available for LOAD DATA INFILE.
2006-08-02 17:15:50 +05:00
evgen@sunlight.local
ef4f149536 Merge sunlight.local:/local_work/tmp_merge-5.0-opt-mysql
into  sunlight.local:/local_work/tmp_merge-5.1-opt-mysql
2006-07-30 00:33:24 +04:00
bar@mysql.com/bar.intranet.mysql.r18.ru
29bc5cc179 Bug#6147: Traditional: Assigning a string to a numeric column has unexpected results
The problem was that when converting a string to an exact number,
rounding didn't work, because conversion didn't understand
approximate numbers notation.
Fix: a new function for string-to-number conversion was implemented,
which is aware of approxinate number notation (with decimal point
and exponent, e.g. -19.55e-1)
2006-07-20 13:41:12 +05:00
igor@olga.mysql.com
f608064083 Fixed bug #19714.
DESCRIBE returned the type BIGINT for a column of a view if the column
was specified by an expression over values of the type INT.
    
E.g. for the view defined as follows:
  CREATE VIEW v1 SELECT COALESCE(f1,f2) FROM t1
DESCRIBE returned type BIGINT for the only column of the view if f1,f2 are
columns of the INT type.
At the same time DESCRIBE returned type INT for the only column of the table
defined by the statement:
  CREATE TABLE t2 SELECT COALESCE(f1,f2) FROM t1.
    
This inconsistency was removed by the patch.

Now the code chooses between INT/BIGINT depending on the
precision of the aggregated column type.
 
Thus both DESCRIBE commands above returns type INT for v1 and t2.
2006-07-13 20:48:26 -07:00
kent@mysql.com
5842dcaa7d Merge mysql.com:/data0/mysqldev/my/tmp_merge
into  mysql.com:/tmp/mysql-5.1-new
2006-05-17 23:35:08 +02:00
gluh@eagle.intranet.mysql.r18.ru
98b81c4f25 Bug#17048 CREATE TABLE ... SELECT truncate values
remove initialization of unsigned_flag for Item_decimal
2006-05-13 13:13:05 +05:00
msvensson@neptunus.(none)
c4b1fb68b4 Bug#10460 SHOW CREATE TABLE uses inconsistent upper/lower case 2006-02-22 10:09:59 +01: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
msvensson@neptunus.(none)
168520a026 Merge neptunus.(none):/home/msvensson/mysql/wl2930/my50-wl2930-integration
into  neptunus.(none):/home/msvensson/mysql/wl2930/my51-wl2930-integration
2005-12-20 14:35:52 +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
msvensson@neptunus.(none)
e5eb7cbf29 WL#2930 Adding view and cursor 'protocols' to mysqltest
- Cleanup of mysqltest.c before extending it
2005-10-31 12:25:08 +01:00
pem@mysql.com
2f3682db7e Fixed BUG#12589: Assert when creating temp. table from decimal stored
procedure variable
  Second version, after review.
  Keep the unsigned_flag in Item_decimal updated. Note that this also changed
  the result of several old test results - creating tables from decimal
  templates now gives unsigned columns and different sizes. (Several tests
  had Length > Max_length before.)
2005-09-27 17:07:28 +02:00
timour@mysql.com
e040300393 WL#2486 - natural and using join according to SQL:2003
* Provide backwards compatibility extension to name resolution of
  coalesced columns. The patch allows such columns to be qualified
  with a table (and db) name, as it is in 4.1.
  Based on a patch from Monty.

* Adjusted tests accordingly to test both backwards compatible name
  resolution of qualified columns, and ANSI-style resolution of
  non-qualified columns.
  For this, each affected test has two versions - one with qualified
  columns, and one without.
2005-08-23 18:08:04 +03:00
timour@mysql.com
a247282aa6 Implementation of WL#2486 -
"Process NATURAL and USING joins according to SQL:2003".

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

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

NOTICE:
- This patch is not complete in the sense that
  - there are 2 test cases that still do not pass -
    one in join.test, one in select.test. Both are marked
    with a comment "TODO: WL#2486".
  - it does not include a new test specific for the task
2005-08-12 17:57:19 +03:00
jimw@mysql.com
d7fbff3ec5 Merge mysql.com:/home/jimw/my/mysql-5.0-5906
into  mysql.com:/home/jimw/my/mysql-5.0-clean
2005-07-19 19:59:34 -07:00
jimw@mysql.com
dd2f631ec4 Fix number to date conversion so it always honors the NO_ZERO_DATE,
NO_ZERO_IN_DATE, and INVALID_DATES bits of SQL_MODE. (Bug #5906)
2005-07-18 16:12:44 -07:00
konstantin@mysql.com
3f28ad8eb7 Merge mysql.com:/opt/local/work/mysql-4.1-root
into  mysql.com:/opt/local/work/mysql-5.0-root
2005-07-14 20:02:32 +04:00
konstantin@mysql.com
62b8e6fdd1 A fix and a test case for Bug#9735.
No separate typecode for MEDIUMTEXT/LONGTEXT is added, as we
have no sound decision yet what typecodes and for what types are
sent by the server (aka what constitutes a distinct type in MySQL).
2005-07-14 15:13:23 +04:00
msvensson@neptunus.(none)
88c96026af Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/bug10466
2005-06-27 13:12:10 +02:00
msvensson@neptunus.(none)
6282d89b0a bug#10466: Datatype "timestamp" displays "YYYYMMDDHHMMSS" irrespective of display sizes.
- Print warning that says display width is not supported for datatype TIMESTAMP, if user tries to create a TIMESTAMP column with display width.
 - Use display width for TIMESTAMP only in type_timestamp test to make sure warning is displayed correctly.
2005-06-20 12:09:00 +02:00
mskold@mysql.com
333c34d50c Added order by for failing ps_7ndb test 2005-06-14 16:40:50 +02:00
igor@rurik.mysql.com
c963b12fd3 Merge rurik.mysql.com:/home/igor/dev/mysql-4.1-0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
2005-06-07 06:38:05 -07:00
igor@rurik.mysql.com
d3f3cc617d Many files:
Fixed bug #9899: erronious NOT_NULL flag for some attributes
  in the EXPLAIN table.
2005-06-07 06:34:13 -07:00
konstantin@mysql.com
9f379d7f05 Patch two (the final one) for Bug#7306 "the server side preparedStatement
error for LIMIT placeholder".
The patch adds grammar support for LIMIT ?, ? and changes the
type of ST_SELECT_LEX::select_limit,offset_limit from ha_rows to Item*,
so that it can point to Item_param.
2005-06-07 14:11:36 +04:00
holyfoot@hf-ibm.(none)
8f3647005c Tests and results fixed with last precision/decimal related modifications 2005-05-06 01:01:39 +05:00
msvensson@neptunus.(none)
c93ae4f8a1 Merge 2005-03-30 14:32:53 +02:00
msvensson@neptunus.(none)
9471e922f1 Merge neptunus.(none):/home/msvensson/mysql/bug8807
into neptunus.(none):/home/msvensson/mysql/mysql-4.1-synced
2005-03-30 14:30:32 +02:00