Commit 963d57a3 authored by unknown's avatar unknown

Fixed problem with timestamps in binary log on 64 bit machines

Backported fix from 4.1 for bug 212: SELECT query containing a NATURAL JOIN and parentheses in the WHERE clause


mysql-test/r/join.result:
  New test results
mysql-test/t/join.test:
  Test for bug 212
sql/log_event.cc:
  Removed wrong cast
sql/log_event.h:
  Fixed problem with timestamps in binary log on 64 bit machines
sql/sql_list.h:
  Fix for bug 212 (back ported from 4.1)
parent a312e137
......@@ -41,3 +41,6 @@ rate_code base_rate
cust 20
rate_code base_rate
cust 20
ID Value1 ID Value2
ID Value1 ID Value2
ID Value1 ID Value2
......@@ -243,3 +243,17 @@ INSERT INTO t2 VALUES ('rivercats','cust',20);
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
drop table t1,t2;
#
# Problem with internal list handling when reducing WHERE
#
CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, Value1 VARCHAR(255));
CREATE TABLE t2 (ID INTEGER NOT NULL PRIMARY KEY, Value2 VARCHAR(255));
INSERT INTO t1 VALUES (1, 'A');
INSERT INTO t2 VALUES (1, 'B');
SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND (Value1 = 'A' AND Value2 <> 'B');
SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND Value1 = 'A' AND Value2 <> 'B';
SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
drop table t1,t2;
......@@ -304,7 +304,7 @@ void Start_log_event::print(FILE* file, bool short_form, char* last_db)
print_header(file);
fprintf(file, "\tStart: binlog v %d, server v %s created ", binlog_version,
server_version);
print_timestamp(file, (time_t*)&created);
print_timestamp(file, &created);
fputc('\n', file);
fflush(file);
}
......
......@@ -327,13 +327,13 @@ extern char server_version[SERVER_VERSION_LENGTH];
class Start_log_event: public Log_event
{
public:
uint32 created;
time_t created;
uint16 binlog_version;
char server_version[50];
Start_log_event() :Log_event(time(NULL)),binlog_version(BINLOG_VERSION)
{
created = (uint32) when;
created = (time_t) when;
memcpy(server_version, ::server_version, sizeof(server_version));
}
Start_log_event(IO_CACHE* file, time_t when_arg, uint32 server_id_arg) :
......@@ -345,7 +345,7 @@ public:
binlog_version = uint2korr(buf+4);
memcpy(server_version, buf + 6, sizeof(server_version));
server_version[sizeof(server_version)-1]=0;
created = uint4korr(buf + 6 + sizeof(server_version));
created = (time_t) uint4korr(buf + 6 + sizeof(server_version));
}
Start_log_event(const char* buf);
......@@ -354,7 +354,7 @@ public:
int write_data(IO_CACHE* file);
int get_data_size()
{
// sizeof(binlog_version) + sizeof(server_version) sizeof(created)
// size(binlog_version) + sizeof(server_version) + size(created)
return 2 + sizeof(server_version) + 4;
}
void print(FILE* file, bool short_form = 0, char* last_db = 0);
......
......@@ -160,6 +160,8 @@ public:
*new_list.last=current->next;
current->info=new_list.first->info;
current->next=new_list.first->next;
if (list->last == &current->next && new_list.elements > 1)
list->last= new_list.last;
list->elements+=new_list.elements-1;
}
return ret_value; // return old element
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment