mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
76f0b94bb0
sql/sql_insert.cc: CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. ****** CREATE ... IF NOT EXISTS may do nothing, but it is still not a failure. don't forget to my_ok it. sql/sql_table.cc: small cleanup ****** small cleanup
185 lines
4.9 KiB
Text
185 lines
4.9 KiB
Text
** Setup **
|
|
|
|
SET @session_time_zone = @@SESSION.time_zone;
|
|
SET @global_time_zone = @@GLOBAL.time_zone;
|
|
CREATE TABLE t1 (a datetime);
|
|
CREATE TABLE t2 (a timestamp);
|
|
'#-----------------------------FN_DYNVARS_177_01--------------------#'
|
|
SET @@time_zone = DEFAULT;
|
|
SELECT @@time_zone;
|
|
@@time_zone
|
|
SYSTEM
|
|
SYSTEM Expected
|
|
'#-----------------------------FN_DYNVARS_177_02-------------------#'
|
|
SET @@time_zone = '+05:00';
|
|
SELECT @@time_zone;
|
|
@@time_zone
|
|
+05:00
|
|
+05:00 Expected
|
|
SET @@time_zone = '-01:00';
|
|
SELECT @@time_zone;
|
|
@@time_zone
|
|
-01:00
|
|
-01:00 Expected
|
|
SET @@time_zone = '+00:00';
|
|
SELECT @@time_zone;
|
|
@@time_zone
|
|
+00:00
|
|
+00:00 Expected
|
|
SET @@time_zone = '-00:00';
|
|
SELECT @@time_zone;
|
|
@@time_zone
|
|
+00:00
|
|
-00:00 Expected
|
|
'#-----------------------------FN_DYNVARS_177_03----------------#'
|
|
SET @@time_zone = '+00:00';
|
|
INSERT INTO t1 VALUES('2008-03-05 16:28:00');
|
|
INSERT INTO t1 VALUES('1970-01-01 00:05:00'),('1970-01-01 01:05:00');
|
|
INSERT INTO t2 VALUES(20080305162800);
|
|
INSERT INTO t2 VALUES(19730101235900);
|
|
INSERT INTO t2 VALUES('1970-01-01 00:05:00'),('1970-01-01 01:05:00');
|
|
INSERT INTO t2 VALUES(19700101000500);
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204734480
|
|
1970-01-01 00:05:00 300
|
|
1970-01-01 01:05:00 3900
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204734480
|
|
1973-01-01 23:59:00 94780740
|
|
1970-01-01 00:05:00 300
|
|
1970-01-01 01:05:00 3900
|
|
1970-01-01 00:05:00 300
|
|
SET @@time_zone = 'MET';
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204730880
|
|
1970-01-01 00:05:00 NULL
|
|
1970-01-01 01:05:00 300
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 17:28:00 1204734480
|
|
1973-01-02 00:59:00 94780740
|
|
1970-01-01 01:05:00 300
|
|
1970-01-01 02:05:00 3900
|
|
1970-01-01 01:05:00 300
|
|
SET @@time_zone = '+05:00';
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204716480
|
|
1970-01-01 00:05:00 NULL
|
|
1970-01-01 01:05:00 NULL
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 21:28:00 1204734480
|
|
1973-01-02 04:59:00 94780740
|
|
1970-01-01 05:05:00 300
|
|
1970-01-01 06:05:00 3900
|
|
1970-01-01 05:05:00 300
|
|
SET @@time_zone = '+06:00';
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204712880
|
|
1970-01-01 00:05:00 NULL
|
|
1970-01-01 01:05:00 NULL
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 22:28:00 1204734480
|
|
1973-01-02 05:59:00 94780740
|
|
1970-01-01 06:05:00 300
|
|
1970-01-01 07:05:00 3900
|
|
1970-01-01 06:05:00 300
|
|
SET @@time_zone = '+01:00';
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204730880
|
|
1970-01-01 00:05:00 NULL
|
|
1970-01-01 01:05:00 300
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 17:28:00 1204734480
|
|
1973-01-02 00:59:00 94780740
|
|
1970-01-01 01:05:00 300
|
|
1970-01-01 02:05:00 3900
|
|
1970-01-01 01:05:00 300
|
|
SET @@time_zone = '+02:00';
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204727280
|
|
1970-01-01 00:05:00 NULL
|
|
1970-01-01 01:05:00 NULL
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 18:28:00 1204734480
|
|
1973-01-02 01:59:00 94780740
|
|
1970-01-01 02:05:00 300
|
|
1970-01-01 03:05:00 3900
|
|
1970-01-01 02:05:00 300
|
|
SET @@time_zone = '+00:00';
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204734480
|
|
1970-01-01 00:05:00 300
|
|
1970-01-01 01:05:00 3900
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204734480
|
|
1973-01-01 23:59:00 94780740
|
|
1970-01-01 00:05:00 300
|
|
1970-01-01 01:05:00 3900
|
|
1970-01-01 00:05:00 300
|
|
SET @@time_zone = '+06:00';
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t1;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 16:28:00 1204712880
|
|
1970-01-01 00:05:00 NULL
|
|
1970-01-01 01:05:00 NULL
|
|
SELECT a,UNIX_TIMESTAMP(a) FROM t2;
|
|
a UNIX_TIMESTAMP(a)
|
|
2008-03-05 22:28:00 1204734480
|
|
1973-01-02 05:59:00 94780740
|
|
1970-01-01 06:05:00 300
|
|
1970-01-01 07:05:00 3900
|
|
1970-01-01 06:05:00 300
|
|
Potential Feature: upon recovery of timezone,
|
|
the original value of the timestamp should be recovered.
|
|
'#-----------------------------FN_DYNVARS_177_04--------------------#'
|
|
SET @@time_zone = '6';
|
|
ERROR HY000: Unknown or incorrect time zone: '6'
|
|
'#-----------------------------FN_DYNVARS_177_05---------------#'
|
|
SET GLOBAL time_zone = 'SYSTEM';
|
|
** Connecting con_int1 using root **
|
|
** Connection con_int1 **
|
|
SELECT @@SESSION.time_zone;
|
|
@@SESSION.time_zone
|
|
SYSTEM
|
|
SYSTEM Expected
|
|
SET SESSION time_zone = '+05:00';
|
|
** Connecting con_int2 using root **
|
|
** Connection con_int2 **
|
|
SELECT @@SESSION.time_zone;
|
|
@@SESSION.time_zone
|
|
SYSTEM
|
|
SYSTEM Expected
|
|
SET SESSION time_zone = '-10:00';
|
|
** Connection con_int2 **
|
|
SELECT @@SESSION.time_zone;
|
|
@@SESSION.time_zone
|
|
-10:00
|
|
-10:00 Expected
|
|
** Connection con_int1 **
|
|
SELECT @@SESSION.time_zone;
|
|
@@SESSION.time_zone
|
|
+05:00
|
|
+05:00 Expected
|
|
SELECT @@GLOBAL.time_zone;
|
|
@@GLOBAL.time_zone
|
|
SYSTEM
|
|
SYSTEM Expected
|
|
** Connection default **
|
|
Disconnecting Connections con_int1, con_int2
|
|
SET @@SESSION.time_zone = @session_time_zone;
|
|
SET @@GLOBAL.time_zone = @global_time_zone;
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|