Port MySQL patch for functions with constant values
From Jay:
Basically, the fixes are to ensure items in the parsed syntax tree which evaluate to a constant (such as UNIX_TIMESTAMP(
The port would be to take the commit and apply it almost as-is to Drizzle, add the associated test cases, and cleanup any non-Drizzle stuff in the commit (pretty minimal).
First come, first served! I can help out any takers on IRC.
-------- Original Message --------
Subject: Re: Functions of constant values
Date: Thu, 03 Dec 2009 18:53:54 +0100
From: Sergei Golubchik <email address hidden>
To: Olivier <email address hidden>
CC: <email address hidden> <email address hidden>
References: <email address hidden> <email address hidden> <email address hidden> <email address hidden> <email address hidden> <00af01ca7371$
Hi, Olivier!
> Is there a reason to compute some functions of constant values multiple times?
No.
> While debugging, I found unix_timestamp(
> times in the (silly) example below (MySQL 5.1.41):
>
> DROP DATABASE IF EXISTS `test`;
> CREATE DATABASE `test`;
> DROP TABLE IF EXISTS `test`.`test`;
> CREATE TABLE `test`.`test` (
> `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
> INSERT INTO `test`.`test` VALUES('2009-12-03 14:00:00'
> SELECT * FROM `test`.`test` WHERE unix_timestamp(t) >= unix_timestamp(
>
> I thought deterministic functions of constant values where always
> optimized away by the query engine? Or this is a bug in
> unix_timestamp()?
The fix was just pushed this week.
http://
http://
http://
It didn't make it into 5.1, but it'll be in the next GA release.
--
Blueprint information
- Status:
- Complete
- Approver:
- Jay Pipes
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- Superseded
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
- Lee Bieber