2003-08-27 21:30:50 +02:00
|
|
|
-- This script converts any old privilege tables to privilege tables suitable
|
2005-03-21 17:53:48 +01:00
|
|
|
-- for this version of MySQL
|
2003-08-27 21:30:50 +02:00
|
|
|
|
|
|
|
-- You can safely ignore all 'Duplicate column' and 'Unknown column' errors"
|
2004-06-28 18:26:54 +02:00
|
|
|
-- because these just mean that your tables are already up to date.
|
2003-08-27 21:30:50 +02:00
|
|
|
-- This script is safe to run even if your tables are already up to date!
|
|
|
|
|
|
|
|
-- On unix, you should use the mysql_fix_privilege_tables script to execute
|
|
|
|
-- this sql script.
|
2004-03-19 17:33:38 +01:00
|
|
|
-- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql'
|
2003-08-27 21:30:50 +02:00
|
|
|
|
2005-04-18 23:01:18 +02:00
|
|
|
set storage_engine=MyISAM;
|
2005-04-16 03:12:30 +02:00
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
CREATE TABLE IF NOT EXISTS func (
|
2004-03-19 17:33:38 +01:00
|
|
|
name char(64) binary DEFAULT '' NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
ret tinyint(1) DEFAULT '0' NOT NULL,
|
|
|
|
dl char(128) DEFAULT '' NOT NULL,
|
2005-02-11 05:25:14 +01:00
|
|
|
type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
PRIMARY KEY (name)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 COLLATE utf8_bin;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
2005-11-06 13:13:06 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS plugin (
|
|
|
|
name char(64) binary DEFAULT '' NOT NULL,
|
|
|
|
dl char(128) DEFAULT '' NOT NULL,
|
|
|
|
PRIMARY KEY (name)
|
|
|
|
) CHARACTER SET utf8 COLLATE utf8_bin;
|
|
|
|
|
2005-02-11 05:25:14 +01:00
|
|
|
ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
-- Detect whether or not we had the Grant_priv column
|
|
|
|
SET @hadGrantPriv:=0;
|
|
|
|
SELECT @hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%';
|
|
|
|
|
2005-02-11 05:25:14 +01:00
|
|
|
ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
|
|
|
ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
|
|
|
ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
2005-11-01 00:56:52 +01:00
|
|
|
-- Fix privileges for old tables
|
2003-06-04 17:28:51 +02:00
|
|
|
UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
|
|
|
UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
|
|
|
UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
|
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
--
|
|
|
|
-- The second alter changes ssl_type to new 4.0.2 format
|
|
|
|
-- Adding columns needed by GRANT .. REQUIRE (openssl)"
|
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
ALTER TABLE user
|
2005-02-11 05:25:14 +01:00
|
|
|
ADD ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
ADD ssl_cipher BLOB NOT NULL,
|
|
|
|
ADD x509_issuer BLOB NOT NULL,
|
|
|
|
ADD x509_subject BLOB NOT NULL;
|
|
|
|
ALTER TABLE user MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL;
|
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
--
|
|
|
|
-- Create tables_priv and columns_priv if they don't exists
|
|
|
|
--
|
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
CREATE TABLE IF NOT EXISTS tables_priv (
|
2004-03-19 17:33:38 +01:00
|
|
|
Host char(60) binary DEFAULT '' NOT NULL,
|
|
|
|
Db char(64) binary DEFAULT '' NOT NULL,
|
|
|
|
User char(16) binary DEFAULT '' NOT NULL,
|
|
|
|
Table_name char(64) binary DEFAULT '' NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
Grantor char(77) DEFAULT '' NOT NULL,
|
|
|
|
Timestamp timestamp(14),
|
2005-02-11 05:25:14 +01:00
|
|
|
Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
|
|
|
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
PRIMARY KEY (Host,Db,User,Table_name)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 COLLATE utf8_bin;
|
2005-02-11 05:25:14 +01:00
|
|
|
-- Fix collation of set fields
|
|
|
|
ALTER TABLE tables_priv
|
|
|
|
modify Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
|
|
|
modify Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
2005-04-18 23:01:18 +02:00
|
|
|
ALTER TABLE procs_priv ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
2005-02-18 01:16:58 +01:00
|
|
|
ALTER TABLE procs_priv
|
|
|
|
modify Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
2005-05-17 20:54:20 +02:00
|
|
|
ALTER TABLE procs_priv
|
|
|
|
add Routine_type enum('FUNCTION','PROCEDURE') COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
|
|
|
|
ALTER TABLE procs_priv
|
|
|
|
modify Timestamp timestamp(14) AFTER Proc_priv;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS columns_priv (
|
|
|
|
Host char(60) DEFAULT '' NOT NULL,
|
2005-01-07 19:50:41 +01:00
|
|
|
Db char(64) DEFAULT '' NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
User char(16) DEFAULT '' NOT NULL,
|
2005-01-07 19:50:41 +01:00
|
|
|
Table_name char(64) DEFAULT '' NOT NULL,
|
|
|
|
Column_name char(64) DEFAULT '' NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
Timestamp timestamp(14),
|
2005-02-11 05:25:14 +01:00
|
|
|
Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
2003-06-04 17:28:51 +02:00
|
|
|
PRIMARY KEY (Host,Db,User,Table_name,Column_name)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 COLLATE utf8_bin;
|
2005-02-11 05:25:14 +01:00
|
|
|
-- Fix collation of set fields
|
|
|
|
ALTER TABLE columns_priv
|
|
|
|
MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Name change of Type -> Column_priv from MySQL 3.22.12
|
|
|
|
--
|
|
|
|
|
2005-02-11 05:25:14 +01:00
|
|
|
ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
--
|
|
|
|
-- Add the new 'type' column to the func table.
|
|
|
|
--
|
|
|
|
|
2005-02-11 05:25:14 +01:00
|
|
|
ALTER TABLE func add type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
--
|
|
|
|
-- Change the user,db and host tables to MySQL 4.0 format
|
|
|
|
--
|
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
# Detect whether we had Show_db_priv
|
|
|
|
SET @hadShowDbPriv:=0;
|
|
|
|
SELECT @hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%';
|
|
|
|
|
|
|
|
ALTER TABLE user
|
2005-02-11 05:25:14 +01:00
|
|
|
ADD Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_priv,
|
|
|
|
ADD Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_db_priv,
|
|
|
|
ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Super_priv,
|
|
|
|
ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv,
|
|
|
|
ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv,
|
|
|
|
ADD Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Execute_priv,
|
|
|
|
ADD Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_slave_priv;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
-- Convert privileges so that users have similar privileges as before
|
|
|
|
|
|
|
|
UPDATE user SET Show_db_priv= Select_priv, Super_priv=Process_priv, Execute_priv=Process_priv, Create_tmp_table_priv='Y', Lock_tables_priv='Y', Repl_slave_priv=file_priv, Repl_client_priv=File_priv where user<>"" AND @hadShowDbPriv = 0;
|
|
|
|
|
|
|
|
|
|
|
|
-- Add fields that can be used to limit number of questions and connections
|
|
|
|
-- for some users.
|
2003-06-04 17:28:51 +02:00
|
|
|
ALTER TABLE user
|
2004-10-02 21:20:08 +02:00
|
|
|
ADD max_questions int(11) NOT NULL DEFAULT 0 AFTER x509_subject,
|
|
|
|
ADD max_updates int(11) unsigned NOT NULL DEFAULT 0 AFTER max_questions,
|
|
|
|
ADD max_connections int(11) unsigned NOT NULL DEFAULT 0 AFTER max_updates;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Add Create_tmp_table_priv and Lock_tables_priv to db and host
|
|
|
|
--
|
|
|
|
|
2003-06-04 17:28:51 +02:00
|
|
|
ALTER TABLE db
|
2005-02-11 05:25:14 +01:00
|
|
|
ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
2003-06-04 17:28:51 +02:00
|
|
|
ALTER TABLE host
|
|
|
|
ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,
|
|
|
|
ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL;
|
2004-03-03 16:12:13 +01:00
|
|
|
|
2004-03-19 17:33:38 +01:00
|
|
|
alter table user change max_questions max_questions int(11) unsigned DEFAULT 0 NOT NULL;
|
|
|
|
alter table tables_priv add KEY Grantor (Grantor);
|
|
|
|
|
|
|
|
alter table db comment='Database privileges';
|
|
|
|
alter table host comment='Host privileges; Merged with database privileges';
|
|
|
|
alter table user comment='Users and global privileges';
|
|
|
|
alter table func comment='User defined functions';
|
|
|
|
alter table tables_priv comment='Table privileges';
|
|
|
|
alter table columns_priv comment='Column privileges';
|
2004-09-11 17:46:06 +02:00
|
|
|
|
2005-02-11 05:25:14 +01:00
|
|
|
-- Convert all tables to UTF-8 with binary collation
|
|
|
|
-- and reset all char columns to correct width
|
|
|
|
ALTER TABLE user
|
|
|
|
MODIFY Host char(60) NOT NULL default '',
|
|
|
|
MODIFY User char(16) NOT NULL default '',
|
|
|
|
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
|
|
|
ALTER TABLE user
|
2005-10-13 16:16:19 +02:00
|
|
|
MODIFY Password char(41) character set latin1 collate latin1_bin NOT NULL default '',
|
2005-02-11 05:25:14 +01:00
|
|
|
MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
|
|
|
ALTER TABLE db
|
|
|
|
MODIFY Host char(60) NOT NULL default '',
|
|
|
|
MODIFY Db char(64) NOT NULL default '',
|
|
|
|
MODIFY User char(16) NOT NULL default '',
|
|
|
|
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
|
|
|
ALTER TABLE db
|
|
|
|
MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
|
|
|
ALTER TABLE host
|
|
|
|
MODIFY Host char(60) NOT NULL default '',
|
|
|
|
MODIFY Db char(64) NOT NULL default '',
|
|
|
|
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
|
|
|
ALTER TABLE host
|
|
|
|
MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
|
|
|
MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
|
|
|
ALTER TABLE func
|
|
|
|
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
|
|
|
ALTER TABLE func
|
|
|
|
MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL;
|
|
|
|
ALTER TABLE columns_priv
|
|
|
|
MODIFY Host char(60) NOT NULL default '',
|
|
|
|
MODIFY Db char(64) NOT NULL default '',
|
|
|
|
MODIFY User char(16) NOT NULL default '',
|
|
|
|
MODIFY Table_name char(64) NOT NULL default '',
|
|
|
|
MODIFY Column_name char(64) NOT NULL default '',
|
|
|
|
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
|
|
|
ALTER TABLE columns_priv
|
|
|
|
MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
|
|
|
ALTER TABLE tables_priv
|
|
|
|
MODIFY Host char(60) NOT NULL default '',
|
|
|
|
MODIFY Db char(64) NOT NULL default '',
|
|
|
|
MODIFY User char(16) NOT NULL default '',
|
|
|
|
MODIFY Table_name char(64) NOT NULL default '',
|
|
|
|
MODIFY Grantor char(77) NOT NULL default '',
|
|
|
|
ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
|
|
|
|
ALTER TABLE tables_priv
|
|
|
|
MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
|
|
|
MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
|
|
|
|
2004-09-11 17:46:06 +02:00
|
|
|
#
|
|
|
|
# Detect whether we had Create_view_priv
|
|
|
|
#
|
|
|
|
SET @hadCreateViewPriv:=0;
|
|
|
|
SELECT @hadCreateViewPriv:=1 FROM user WHERE Create_view_priv LIKE '%';
|
|
|
|
|
2004-07-16 00:15:55 +02:00
|
|
|
#
|
2004-07-19 05:16:42 +02:00
|
|
|
# Create VIEWs privileges (v5.0)
|
2004-07-16 00:15:55 +02:00
|
|
|
#
|
2005-02-18 03:07:14 +01:00
|
|
|
ALTER TABLE db ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
|
|
|
|
ALTER TABLE host ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv;
|
|
|
|
ALTER TABLE user ADD Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_client_priv;
|
2004-07-16 00:15:55 +02:00
|
|
|
|
|
|
|
#
|
2004-07-19 05:16:42 +02:00
|
|
|
# Show VIEWs privileges (v5.0)
|
2004-07-16 00:15:55 +02:00
|
|
|
#
|
2005-02-18 03:07:14 +01:00
|
|
|
ALTER TABLE db ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
|
|
|
ALTER TABLE host ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
|
|
|
ALTER TABLE user ADD Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_view_priv;
|
2004-03-19 17:33:38 +01:00
|
|
|
|
2005-07-05 12:36:36 +02:00
|
|
|
#
|
|
|
|
# Show/Create views table privileges (v5.0)
|
|
|
|
#
|
|
|
|
ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
|
|
|
|
2004-09-11 17:46:06 +02:00
|
|
|
#
|
|
|
|
# Assign create/show view privileges to people who have create provileges
|
|
|
|
#
|
|
|
|
UPDATE user SET Create_view_priv=Create_priv, Show_view_priv=Create_priv where user<>"" AND @hadCreateViewPriv = 0;
|
|
|
|
|
2004-12-23 11:46:24 +01:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
SET @hadCreateRoutinePriv:=0;
|
|
|
|
SELECT @hadCreateRoutinePriv:=1 FROM user WHERE Create_routine_priv LIKE '%';
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create PROCEDUREs privileges (v5.0)
|
|
|
|
#
|
2005-02-18 03:07:14 +01:00
|
|
|
ALTER TABLE db ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
|
2005-05-02 19:25:47 +02:00
|
|
|
ALTER TABLE host ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
|
2005-02-18 03:07:14 +01:00
|
|
|
ALTER TABLE user ADD Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_view_priv;
|
2004-12-23 11:46:24 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Alter PROCEDUREs privileges (v5.0)
|
|
|
|
#
|
2005-02-18 03:07:14 +01:00
|
|
|
ALTER TABLE db ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
|
2005-05-02 19:25:47 +02:00
|
|
|
ALTER TABLE host ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
|
2005-02-18 03:07:14 +01:00
|
|
|
ALTER TABLE user ADD Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_routine_priv;
|
2004-12-23 11:46:24 +01:00
|
|
|
|
2005-02-18 03:07:14 +01:00
|
|
|
ALTER TABLE db ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
|
2005-05-02 19:25:47 +02:00
|
|
|
ALTER TABLE host ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
|
2004-12-23 11:46:24 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Assign create/alter routine privileges to people who have create privileges
|
|
|
|
#
|
|
|
|
UPDATE user SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv where user<>"" AND @hadCreateRoutinePriv = 0;
|
|
|
|
UPDATE db SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv, Execute_priv=Select_priv where user<>"" AND @hadCreateRoutinePriv = 0;
|
2005-02-08 03:40:14 +01:00
|
|
|
UPDATE host SET Create_routine_priv=Create_priv, Alter_routine_priv=Alter_priv, Execute_priv=Select_priv where @hadCreateRoutinePriv = 0;
|
2004-12-23 11:46:24 +01:00
|
|
|
|
2004-12-29 18:30:37 +01:00
|
|
|
#
|
|
|
|
# Add max_user_connections resource limit
|
|
|
|
#
|
|
|
|
ALTER TABLE user ADD max_user_connections int(11) unsigned DEFAULT '0' NOT NULL AFTER max_connections;
|
|
|
|
|
2005-03-22 15:54:18 +01:00
|
|
|
#
|
|
|
|
# user.Create_user_priv
|
|
|
|
#
|
|
|
|
|
|
|
|
SET @hadCreateUserPriv:=0;
|
|
|
|
SELECT @hadCreateUserPriv:=1 FROM user WHERE Create_user_priv LIKE '%';
|
|
|
|
|
|
|
|
ALTER TABLE user ADD Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_routine_priv;
|
|
|
|
UPDATE user LEFT JOIN db USING (Host,User) SET Create_user_priv='Y'
|
|
|
|
WHERE @hadCreateUserPriv = 0 AND
|
|
|
|
(user.Grant_priv = 'Y' OR db.Grant_priv = 'Y');
|
|
|
|
|
2003-10-06 21:56:34 +02:00
|
|
|
#
|
|
|
|
# Create some possible missing tables
|
|
|
|
#
|
2004-12-23 11:46:24 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS procs_priv (
|
|
|
|
Host char(60) binary DEFAULT '' NOT NULL,
|
|
|
|
Db char(64) binary DEFAULT '' NOT NULL,
|
|
|
|
User char(16) binary DEFAULT '' NOT NULL,
|
|
|
|
Routine_name char(64) binary DEFAULT '' NOT NULL,
|
2005-05-17 20:54:20 +02:00
|
|
|
Routine_type enum('FUNCTION','PROCEDURE') NOT NULL,
|
2004-12-23 11:46:24 +01:00
|
|
|
Grantor char(77) DEFAULT '' NOT NULL,
|
2005-02-18 01:16:58 +01:00
|
|
|
Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL,
|
2005-05-17 20:54:20 +02:00
|
|
|
Timestamp timestamp(14),
|
|
|
|
PRIMARY KEY (Host,Db,User,Routine_name,Routine_type),
|
2004-12-23 11:46:24 +01:00
|
|
|
KEY Grantor (Grantor)
|
|
|
|
) CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
|
|
|
|
|
2003-10-06 21:56:34 +02:00
|
|
|
CREATE TABLE IF NOT EXISTS help_topic (
|
|
|
|
help_topic_id int unsigned not null,
|
2005-04-18 23:01:18 +02:00
|
|
|
name varchar(64) not null,
|
2003-10-06 21:56:34 +02:00
|
|
|
help_category_id smallint unsigned not null,
|
|
|
|
description text not null,
|
|
|
|
example text not null,
|
2005-04-18 23:01:18 +02:00
|
|
|
url varchar(128) not null,
|
2003-10-06 21:56:34 +02:00
|
|
|
primary key (help_topic_id), unique index (name)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='help topics';
|
2003-10-06 21:56:34 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS help_category (
|
|
|
|
help_category_id smallint unsigned not null,
|
2005-04-18 23:01:18 +02:00
|
|
|
name varchar(64) not null,
|
2003-10-06 21:56:34 +02:00
|
|
|
parent_category_id smallint unsigned null,
|
2005-04-18 23:01:18 +02:00
|
|
|
url varchar(128) not null,
|
2003-10-06 21:56:34 +02:00
|
|
|
primary key (help_category_id),
|
|
|
|
unique index (name)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='help categories';
|
2003-10-06 21:56:34 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS help_relation (
|
|
|
|
help_topic_id int unsigned not null references help_topic,
|
|
|
|
help_keyword_id int unsigned not null references help_keyword,
|
|
|
|
primary key (help_keyword_id, help_topic_id)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='keyword-topic relation';
|
2003-10-06 21:56:34 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS help_keyword (
|
|
|
|
help_keyword_id int unsigned not null,
|
2005-04-18 23:01:18 +02:00
|
|
|
name varchar(64) not null,
|
2003-10-06 21:56:34 +02:00
|
|
|
primary key (help_keyword_id),
|
|
|
|
unique index (name)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='help keywords';
|
2003-10-22 16:10:22 +02:00
|
|
|
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
#
|
|
|
|
# Create missing time zone related tables
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS time_zone_name (
|
|
|
|
Name char(64) NOT NULL,
|
|
|
|
Time_zone_id int unsigned NOT NULL,
|
|
|
|
PRIMARY KEY Name (Name)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='Time zone names';
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS time_zone (
|
|
|
|
Time_zone_id int unsigned NOT NULL auto_increment,
|
2005-02-11 05:25:14 +01:00
|
|
|
Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
PRIMARY KEY TzId (Time_zone_id)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='Time zones';
|
2005-02-11 05:25:14 +01:00
|
|
|
-- Make enum field case-insensitive
|
|
|
|
ALTER TABLE time_zone
|
|
|
|
MODIFY Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS time_zone_transition (
|
|
|
|
Time_zone_id int unsigned NOT NULL,
|
|
|
|
Transition_time bigint signed NOT NULL,
|
|
|
|
Transition_type_id int unsigned NOT NULL,
|
|
|
|
PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='Time zone transitions';
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS time_zone_transition_type (
|
|
|
|
Time_zone_id int unsigned NOT NULL,
|
|
|
|
Transition_type_id int unsigned NOT NULL,
|
|
|
|
Offset int signed DEFAULT 0 NOT NULL,
|
|
|
|
Is_DST tinyint unsigned DEFAULT 0 NOT NULL,
|
|
|
|
Abbreviation char(8) DEFAULT '' NOT NULL,
|
|
|
|
PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='Time zone transition types';
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS time_zone_leap_second (
|
|
|
|
Transition_time bigint signed NOT NULL,
|
|
|
|
Correction int signed NOT NULL,
|
|
|
|
PRIMARY KEY TranTime (Transition_time)
|
2004-09-02 09:34:27 +02:00
|
|
|
) CHARACTER SET utf8 comment='Leap seconds information for time zones';
|
WL#1264 "Per-thread time zone support infrastructure".
Added basic per-thread time zone functionality (based on public
domain elsie-code). Now user can select current time zone
(from the list of time zones described in system tables).
All NOW-like functions honor this time zone, values of TIMESTAMP
type are interpreted as values in this time zone, so now
our TIMESTAMP type behaves similar to Oracle's TIMESTAMP WITH
LOCAL TIME ZONE (or proper PostgresSQL type).
WL#1266 "CONVERT_TZ() - basic time with time zone conversion
function".
Fixed problems described in Bug #2336 (Different number of warnings
when inserting bad datetime as string or as number). This required
reworking of datetime realted warning hadling (they now generated
at Field object level not in conversion functions).
Optimization: Now Field class descendants use table->in_use member
instead of current_thd macro.
include/my_global.h:
Added macro for reading of 32-bit ints stored in network order from
unaligned memory location.
include/mysqld_error.h:
Added error-code for invalid timestamp warning and error-code
for wrong or unknown time zone specification.
libmysqld/Makefile.am:
Added main per-thread time zone support file to libmysqld
libmysqld/lib_sql.cc:
Added initialization of time zones infrastructure to embedded server.
mysql-test/r/connect.result:
Updated test result since now mysql database contains more
system tables.
mysql-test/r/date_formats.result:
Now when truncation occurs during conversion to datetime value we are producing Warnings
instead of Notes. Also we are giving more clear warnings about this in some cases.
mysql-test/r/func_sapdb.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/func_time.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling.
mysql-test/r/select.result:
New warnings about truncation occured during conversion to datetime value added due
their better handling. Also tweaked test a bit to made it less ambigious for reader.
mysql-test/r/system_mysql_db.result:
Updated test result because new system tables holding time zone descriptions were
added.
mysql-test/r/timezone.result:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/r/type_datetime.result:
Separated and extended test of values and warnings produced for bad values stored in
DATETTIME fields.
mysql-test/r/type_time.result:
Now we are producing more consistent warning when we are truncating datetime value while
storing it in TIME field.
mysql-test/r/type_timestamp.result:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
mysql-test/t/select.test:
Updated test to make it less ambigous for reader.
mysql-test/t/timezone.test:
Updated timezone.test to use new system variable which shows system time zone.
Added test of warning which is produced if someone tries to store non-existing (due
falling into spring time-gap) datetime value into TIMESTAMP field.
mysql-test/t/type_datetime.test:
Separated and extended test of values and warnings produced for bad
values stored in DATETTIME fields.
mysql-test/t/type_timestamp.test:
Separated and extended test of values and warnings produced for bad
values stored in TIMESTAMP fields.
scripts/mysql_create_system_tables.sh:
Added creation of tables with time zone descriptions.
Also added descriptions of time zones used in tests.
scripts/mysql_fix_privilege_tables.sql:
Added mysql.time_zone* tables family.
sql/Makefile.am:
Added files implementing time zone support to server, also added
rules for building of mysql_tzinfo_to_sql converter and test_time
test.
sql/field.cc:
Now we are using per-thread time zone for TIMESTAMP <-> whatever conversion.
Fixed generation of warnings for datetime types (DATETIME/TIMESTAMP/DATE/...) and
any other Field to datetime conversion (now we are generating warnings no in lower
level functions like in str_to_TIME() but in Field methods. This allows generate
better and more consistent warnings and to reuse code of str_to_TIME() outside of
server).
Added 3rd parameter to set_warning() method to be able to not increment cut fields
but still produce a warning. Also added set_datetime_warning() family of auxiliary
methods which allow easier generate datetime related warnings.
Also replaced occurences of current_thd with table->in_use member, added
asserts for catching all places there we need to set table->in_use
accordingly. Renamed fix_datetime() function to number_to_TIME() and
moved it to sql/time.cc there it fits better.
sql/field.h:
Added comment about places where we can use table->in_use member
instead of current_thd.
Added 3rd parameter to Field::set_warning() method and set_datetime_warning()
family of methods.
sql/field_conv.cc:
Field::set_warning() method with 2 arguments was replaced with more
generic set_warning() method with 3 arguments.
sql/ha_berkeley.cc:
Now we set table->in_use for temporary tables so we have to use
table->tmp_table for checking if table is temporary.
sql/item.cc:
Replaced calls to str_to_time() and str_to_TIME() funcs with their warning
generating analogs.
sql/item_create.cc:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_create.h:
Added creation of CONVERT_TZ function as FUNC_ARG3.
sql/item_timefunc.cc:
Added support of per-thread time zone to NOW-like and FROM_UNIXTIME,
UNIX_TIMESTAMP functions.
Added support for CONVERT_TZ function.
Removed call to str_to_timestamp function which caused non-optimal
behavior in certain cases. Replaced calls to str_to_time() function
with its warning generating analog.
sql/item_timefunc.h:
Added support of per-thread time zone to NOW-like and
FROM_UNIXTIME, UNIX_TIMESTAMP functions.
Added support of CONVERT_TZ function.
sql/lex.h:
Added support of CONVERT_TZ function.
sql/log.cc:
Added support for replication of statements depending on time zone.
sql/mysql_priv.h:
Now including headers with per-thread time zone support functions
and classes. Added portable replacement of time_t - my_time_t type.
Added time zone as one of query distinguishing parameters for
query cache.
Fixed declarations of str_to_TIME, str_to_time and
my_system_gmt_sec (former my_gmt_sec) since now they have one more
out parameter which informs about wrong datetime value or data
truncation during conversion.
Added warning generating version of str_to_TIME() and str_to_time()
functions.
Thrown away str_to_datetime/timestamp functions since they are not
needed any longer. Added number_to_TIME function.
sql/mysqld.cc:
Added per-thread time zone support initialization.
Added new startup parameter --default-time-zone.
sql/set_var.cc:
Added support for per-thread time_zone variable.
Renamed old timezone variable to system_time_zone.
sql/set_var.h:
Added support for per-thread time_zone variable.
sql/share/czech/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/danish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/dutch/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/english/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/estonian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/french/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/german/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/greek/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/hungarian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/italian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/japanese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/korean/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian-ny/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/norwegian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/polish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/portuguese/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/romanian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/russian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/serbian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/slovak/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/spanish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/swedish/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/share/ukrainian/errmsg.txt:
Added error message for barking when incorrect time zone name or
specifiaction is provided and for warning about invalid TIMESTAMP
values (e.g. falling into the spring time-gap).
sql/slave.cc:
In order to support replication of statements using time zones in 4.1 we should
ensure that both master and slave have same default time zone.
sql/sql_base.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_cache.cc:
Added time zone as one more query distinguishing parameter
for query cache.
sql/sql_class.cc:
Added THD::time_zone_used variable indicating that this query
uses per thread time zone.
sql/sql_class.h:
Added per-thread time zone variable. Added THD::time_zone_used
variable indicating that this query uses per thread time zone
so if this is updating query the time zone should be logged to
binlog.
sql/sql_insert.cc:
We should set TABLE::in_use member pointing to thread which is called
INSERT DELAYED and not to worker thread.
sql/sql_load.cc:
Field::set_warning() now has one more argument now.
sql/sql_parse.cc:
Resetting THD::time_zone_used variable in the end of query
processing.
sql/sql_select.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
sql/sql_show.cc:
Now using per thread time zone for extended show tables.
sql/time.cc:
Added support for per-thread time zones for TIMESTAMP type and
reworked generation of warnings for TIMESTAMP and DATETIME types.
(Introduced new TIME_to_timestamp() function. Removed hours
normalisation from former my_gmt_sec() since it was not working
and not used anywhere now, but breaks parameter constness, added
to this function generation of warning if we are falling in spring
time-gap. Removed str_to_timestamp and str_to_datetime functions
which are no longer used. Moved fix_datetime function from
sql/field.cc to this file as number_to_TIME() function. Added
out parameter for str_to_TIME and str_to_time functions which
indicates if value was truncated during conversion, removed direct
generation of warnings from this functions.)
sql/unireg.cc:
Now we are setting TABLE::in_use member for all tables (which assume
calls to Field::store or val_ methods).
BitKeeper/etc/ignore:
Added sql/test_time sql/mysql_tzinfo_to_sql libmysqld/tztime.cc to the ignore list
2004-06-18 08:11:31 +02:00
|
|
|
|
2004-07-07 10:29:39 +02:00
|
|
|
|
2003-10-01 15:50:50 +02:00
|
|
|
#
|
|
|
|
# Create proc table if it doesn't exists
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS proc (
|
2005-07-08 16:33:15 +02:00
|
|
|
db char(64) collate utf8_bin DEFAULT '' NOT NULL,
|
2004-03-23 12:04:40 +01:00
|
|
|
name char(64) DEFAULT '' NOT NULL,
|
2003-12-10 19:05:37 +01:00
|
|
|
type enum('FUNCTION','PROCEDURE') NOT NULL,
|
2004-03-23 12:04:40 +01:00
|
|
|
specific_name char(64) DEFAULT '' NOT NULL,
|
2003-12-10 19:05:37 +01:00
|
|
|
language enum('SQL') DEFAULT 'SQL' NOT NULL,
|
2004-10-14 18:07:09 +02:00
|
|
|
sql_data_access enum('CONTAINS_SQL',
|
2005-07-08 16:33:15 +02:00
|
|
|
'NO_SQL',
|
|
|
|
'READS_SQL_DATA',
|
|
|
|
'MODIFIES_SQL_DATA'
|
|
|
|
) DEFAULT 'CONTAINS_SQL' NOT NULL,
|
2003-12-10 19:05:37 +01:00
|
|
|
is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL,
|
In order to make ALTER PROCEDURE|FUNCTION work correctly, and in general to
make characteristics (and SHOW) work right, we had to separate the old
definition blob in the mysql.proc table into separate fields for parameters,
return type, and body, and handle the characteristics (like SQL SECURITY)
separately... and then reassemble the CREATE string for parsing, of course.
This is rather ugly, mostly the parser bit. (Hopefully that will be better
with the new parser.)
Docs/sp-imp-spec.txt:
Separated the definitions string of the procedure into different columns
in the mysql.proc schema.
mysql-test/r/sp.result:
New characteristics tests.
mysql-test/t/sp.test:
New characteristics tests.
scripts/mysql_create_system_tables.sh:
Separated the definitions string of the procedure into different columns
in the mysql.proc schema.
scripts/mysql_fix_privilege_tables.sql:
Separated the definitions string of the procedure into different columns
in the mysql.proc schema.
sql/sp.cc:
Separated the definitions string of the procedure into different columns.
Rewrote much of the code related this (have a assemble the definition
string from its different parts now) and the way characteristics are now
handled, in order to make ALTER actually work.
sql/sp.h:
Changed prototypes.
sql/sp_head.cc:
Rewrote much of the code related to the new mysql.proc schema with separate
definition fields (have to assemble the definition string from its different
parts now) and the way characteristics are now handled, in order to make ALTER
actually work.
sql/sp_head.h:
Separated the different parts of the definition strings: name, parameters,
return type (for functions) and body.
sql/sql_yacc.yy:
Separated the different parts of the definition strings: name, parameters,
return type (for functions) and body.
This is ugly and messy; hopefully there's a more elegant way to do this
when the new parser is installed.
2003-12-12 14:05:29 +01:00
|
|
|
security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL,
|
|
|
|
param_list blob DEFAULT '' NOT NULL,
|
|
|
|
returns char(64) DEFAULT '' NOT NULL,
|
2005-07-27 03:08:49 +02:00
|
|
|
body longblob DEFAULT '' NOT NULL,
|
2005-07-08 16:33:15 +02:00
|
|
|
definer char(77) collate utf8_bin DEFAULT '' NOT NULL,
|
2003-12-10 19:05:37 +01:00
|
|
|
created timestamp,
|
|
|
|
modified timestamp,
|
|
|
|
sql_mode set(
|
|
|
|
'REAL_AS_FLOAT',
|
|
|
|
'PIPES_AS_CONCAT',
|
|
|
|
'ANSI_QUOTES',
|
|
|
|
'IGNORE_SPACE',
|
|
|
|
'NOT_USED',
|
|
|
|
'ONLY_FULL_GROUP_BY',
|
|
|
|
'NO_UNSIGNED_SUBTRACTION',
|
|
|
|
'NO_DIR_IN_CREATE',
|
|
|
|
'POSTGRESQL',
|
|
|
|
'ORACLE',
|
|
|
|
'MSSQL',
|
|
|
|
'DB2',
|
|
|
|
'MAXDB',
|
|
|
|
'NO_KEY_OPTIONS',
|
|
|
|
'NO_TABLE_OPTIONS',
|
|
|
|
'NO_FIELD_OPTIONS',
|
|
|
|
'MYSQL323',
|
|
|
|
'MYSQL40',
|
|
|
|
'ANSI',
|
2005-03-09 02:40:43 +01:00
|
|
|
'NO_AUTO_VALUE_ON_ZERO',
|
|
|
|
'NO_BACKSLASH_ESCAPES',
|
|
|
|
'STRICT_TRANS_TABLES',
|
|
|
|
'STRICT_ALL_TABLES',
|
|
|
|
'NO_ZERO_IN_DATE',
|
|
|
|
'NO_ZERO_DATE',
|
|
|
|
'INVALID_DATES',
|
|
|
|
'ERROR_FOR_DIVISION_BY_ZERO',
|
|
|
|
'TRADITIONAL',
|
|
|
|
'NO_AUTO_CREATE_USER',
|
|
|
|
'HIGH_NOT_PRECEDENCE'
|
2005-07-08 16:33:15 +02:00
|
|
|
) DEFAULT '' NOT NULL,
|
|
|
|
comment char(64) collate utf8_bin DEFAULT '' NOT NULL,
|
2003-12-16 19:14:10 +01:00
|
|
|
PRIMARY KEY (db,name,type)
|
2005-07-08 16:33:15 +02:00
|
|
|
) engine=MyISAM
|
|
|
|
character set utf8
|
|
|
|
comment='Stored Procedures';
|
2004-03-23 12:04:40 +01:00
|
|
|
|
2004-10-14 18:07:09 +02:00
|
|
|
# Correct the name fields to not binary, and expand sql_data_access
|
2004-03-23 12:04:40 +01:00
|
|
|
ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
|
2004-10-14 18:07:09 +02:00
|
|
|
MODIFY specific_name char(64) DEFAULT '' NOT NULL,
|
2005-07-08 16:33:15 +02:00
|
|
|
MODIFY sql_data_access
|
|
|
|
enum('CONTAINS_SQL',
|
|
|
|
'NO_SQL',
|
|
|
|
'READS_SQL_DATA',
|
|
|
|
'MODIFIES_SQL_DATA'
|
|
|
|
) DEFAULT 'CONTAINS_SQL' NOT NULL,
|
2005-07-27 03:08:49 +02:00
|
|
|
MODIFY body longblob DEFAULT '' NOT NULL,
|
2005-03-09 02:40:43 +01:00
|
|
|
MODIFY sql_mode
|
|
|
|
set('REAL_AS_FLOAT',
|
|
|
|
'PIPES_AS_CONCAT',
|
|
|
|
'ANSI_QUOTES',
|
|
|
|
'IGNORE_SPACE',
|
|
|
|
'NOT_USED',
|
|
|
|
'ONLY_FULL_GROUP_BY',
|
|
|
|
'NO_UNSIGNED_SUBTRACTION',
|
|
|
|
'NO_DIR_IN_CREATE',
|
|
|
|
'POSTGRESQL',
|
|
|
|
'ORACLE',
|
|
|
|
'MSSQL',
|
|
|
|
'DB2',
|
|
|
|
'MAXDB',
|
|
|
|
'NO_KEY_OPTIONS',
|
|
|
|
'NO_TABLE_OPTIONS',
|
|
|
|
'NO_FIELD_OPTIONS',
|
|
|
|
'MYSQL323',
|
|
|
|
'MYSQL40',
|
|
|
|
'ANSI',
|
|
|
|
'NO_AUTO_VALUE_ON_ZERO',
|
|
|
|
'NO_BACKSLASH_ESCAPES',
|
|
|
|
'STRICT_TRANS_TABLES',
|
|
|
|
'STRICT_ALL_TABLES',
|
|
|
|
'NO_ZERO_IN_DATE',
|
|
|
|
'NO_ZERO_DATE',
|
|
|
|
'INVALID_DATES',
|
|
|
|
'ERROR_FOR_DIVISION_BY_ZERO',
|
|
|
|
'TRADITIONAL',
|
|
|
|
'NO_AUTO_CREATE_USER',
|
|
|
|
'HIGH_NOT_PRECEDENCE'
|
2005-08-24 01:37:21 +02:00
|
|
|
) DEFAULT '' NOT NULL,
|
2005-07-08 16:33:15 +02:00
|
|
|
DEFAULT CHARACTER SET utf8;
|
|
|
|
|
|
|
|
# Correct the character set and collation
|
|
|
|
ALTER TABLE proc CONVERT TO CHARACTER SET utf8;
|
|
|
|
# Reset some fields after the conversion
|
|
|
|
ALTER TABLE proc MODIFY db
|
|
|
|
char(64) collate utf8_bin DEFAULT '' NOT NULL,
|
|
|
|
MODIFY definer
|
|
|
|
char(77) collate utf8_bin DEFAULT '' NOT NULL,
|
|
|
|
MODIFY comment
|
|
|
|
char(64) collate utf8_bin DEFAULT '' NOT NULL;
|
2005-12-05 11:45:04 +01:00
|
|
|
|
2006-01-19 03:56:06 +01:00
|
|
|
--
|
|
|
|
-- Create missing log tables (5.1)
|
|
|
|
--
|
|
|
|
|
|
|
|
delimiter //
|
|
|
|
CREATE PROCEDURE create_log_tables()
|
|
|
|
BEGIN
|
|
|
|
DECLARE is_csv_enabled int DEFAULT 0;
|
|
|
|
SELECT @@have_csv = 'YES' INTO is_csv_enabled;
|
|
|
|
IF (is_csv_enabled) THEN
|
|
|
|
CREATE TABLE IF NOT EXISTS general_log (
|
|
|
|
event_time TIMESTAMP NOT NULL,
|
|
|
|
user_host MEDIUMTEXT,
|
|
|
|
thread_id INTEGER,
|
|
|
|
server_id INTEGER,
|
|
|
|
command_type VARCHAR(64),
|
|
|
|
argument MEDIUMTEXT
|
|
|
|
) engine=CSV CHARACTER SET utf8 comment='General log';
|
|
|
|
CREATE TABLE IF NOT EXISTS slow_log (
|
|
|
|
start_time TIMESTAMP NOT NULL,
|
|
|
|
user_host MEDIUMTEXT NOT NULL,
|
|
|
|
query_time TIME NOT NULL,
|
|
|
|
lock_time TIME NOT NULL,
|
|
|
|
rows_sent INTEGER NOT NULL,
|
|
|
|
rows_examined INTEGER NOT NULL,
|
|
|
|
db VARCHAR(512),
|
|
|
|
last_insert_id INTEGER,
|
|
|
|
insert_id INTEGER,
|
|
|
|
server_id INTEGER,
|
|
|
|
sql_text MEDIUMTEXT NOT NULL
|
|
|
|
) engine=CSV CHARACTER SET utf8 comment='Slow log';
|
|
|
|
END IF;
|
|
|
|
END//
|
|
|
|
delimiter ;
|
|
|
|
CALL create_log_tables();
|
|
|
|
DROP PROCEDURE create_log_tables;
|
2005-12-05 11:45:04 +01:00
|
|
|
#
|
|
|
|
# EVENT table
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE event (
|
2005-12-16 13:01:46 +01:00
|
|
|
db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
|
|
|
|
name char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
|
|
|
|
body longblob NOT NULL,
|
|
|
|
definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
|
|
|
|
execute_at DATETIME default NULL,
|
|
|
|
interval_value int(11) default NULL,
|
|
|
|
interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK',
|
2005-12-05 11:45:04 +01:00
|
|
|
'SECOND','MICROSECOND', 'YEAR_MONTH','DAY_HOUR',
|
|
|
|
'DAY_MINUTE','DAY_SECOND',
|
|
|
|
'HOUR_MINUTE','HOUR_SECOND',
|
|
|
|
'MINUTE_SECOND','DAY_MICROSECOND',
|
|
|
|
'HOUR_MICROSECOND','MINUTE_MICROSECOND',
|
|
|
|
'SECOND_MICROSECOND') default NULL,
|
2005-12-16 13:01:46 +01:00
|
|
|
created TIMESTAMP NOT NULL,
|
|
|
|
modified TIMESTAMP NOT NULL,
|
|
|
|
last_executed DATETIME default NULL,
|
|
|
|
starts DATETIME default NULL,
|
|
|
|
ends DATETIME default NULL,
|
|
|
|
status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED',
|
|
|
|
on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP',
|
|
|
|
comment varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
|
|
|
|
PRIMARY KEY (db,name)
|
2005-12-05 11:45:04 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# EVENT privilege
|
|
|
|
#
|
|
|
|
|
2006-01-11 18:09:05 +01:00
|
|
|
ALTER TABLE user add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL AFTER Create_user_priv;
|
|
|
|
ALTER TABLE db add Event_priv enum('N','Y') character set utf8 DEFAULT 'N' NOT NULL;
|
2005-12-15 14:12:28 +01:00
|
|
|
|