summaryrefslogtreecommitdiff
path: root/mysql-test/main/function_defaults_notembedded.result
blob: 645133bad1dcfa21917623388536611fa2a79d2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#
# Test of function defaults for non-embedded server.
#
#
# Function defaults run 1. No microsecond precision.
#
SET TIME_ZONE = "+00:00";
#
# Test of INSERT DELAYED ... SET ...
#
# 2011-04-19 08:02:40 UTC
SET TIMESTAMP = 1303200160.123456;
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT DELAYED INTO t1 SET a = 1;
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:02:40
SELECT * FROM t1 WHERE b = 0;
a	b
INSERT DELAYED INTO t1 SET a = 2, b = '1980-01-02 10:20:30.405060';
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:02:40
2	1980-01-02 10:20:30
DROP TABLE t1;
#
# Test of INSERT DELAYED ... VALUES ...
#
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.234567;
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT DELAYED INTO t1 ( a ) VALUES (1);
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:04:01
INSERT DELAYED INTO t1 VALUES (2, '1977-12-19 12:34:56.789123');
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:04:01
2	1977-12-19 12:34:56
DROP TABLE t1;
#
# Test of a delayed insert handler servicing two insert operations
# with different sets of active defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
connect con1, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.345678;
SET debug_sync = 'before_write_delayed SIGNAL parked WAIT_FOR go';
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
connection default;
SET debug_sync = 'now WAIT_FOR parked';
connect con2, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIME_ZONE="+03:00";
SET TIMESTAMP = 1303200241.456789;
INSERT DELAYED INTO t1 ( a, b ) VALUES (4, '1977-12-19 12:34:56.789123'), (5, '1977-12-19 12:34:57.891234'), (6, '1977-12-19 12:34:58.912345');
connection default;
SET debug_sync = 'now SIGNAL go';
SELECT * FROM t1;
a	b
1	2011-04-19 08:04:01
2	2011-04-19 08:04:01
3	2011-04-19 08:04:01
4	1977-12-19 09:34:56
5	1977-12-19 09:34:57
6	1977-12-19 09:34:58
disconnect con1;
disconnect con2;
DROP TABLE t1;
#
# Test of early activation of function defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
SET TIMESTAMP = 1317235172.987654;
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
SET TIMESTAMP = 385503754.876543;
INSERT DELAYED INTO t1 ( a ) VALUES (4), (5), (6);
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-09-28 18:39:32
2	2011-09-28 18:39:32
3	2011-09-28 18:39:32
4	1982-03-20 20:22:34
5	1982-03-20 20:22:34
6	1982-03-20 20:22:34
DROP TABLE t1;
SET debug_sync = 'RESET';
#
# Function defaults run 2. Six digits scale on seconds precision.
#
SET TIME_ZONE = "+00:00";
#
# Test of INSERT DELAYED ... SET ...
#
# 2011-04-19 08:02:40 UTC
SET TIMESTAMP = 1303200160.123456;
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
INSERT DELAYED INTO t1 SET a = 1;
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:02:40.123456
SELECT * FROM t1 WHERE b = 0;
a	b
INSERT DELAYED INTO t1 SET a = 2, b = '1980-01-02 10:20:30.405060';
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:02:40.123456
2	1980-01-02 10:20:30.405060
DROP TABLE t1;
#
# Test of INSERT DELAYED ... VALUES ...
#
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.234567;
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
INSERT DELAYED INTO t1 ( a ) VALUES (1);
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:04:01.234567
INSERT DELAYED INTO t1 VALUES (2, '1977-12-19 12:34:56.789123');
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-04-19 08:04:01.234567
2	1977-12-19 12:34:56.789123
DROP TABLE t1;
#
# Test of a delayed insert handler servicing two insert operations
# with different sets of active defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
connect con1, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.345678;
SET debug_sync = 'before_write_delayed SIGNAL parked WAIT_FOR go';
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
connection default;
SET debug_sync = 'now WAIT_FOR parked';
connect con2, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIME_ZONE="+03:00";
SET TIMESTAMP = 1303200241.456789;
INSERT DELAYED INTO t1 ( a, b ) VALUES (4, '1977-12-19 12:34:56.789123'), (5, '1977-12-19 12:34:57.891234'), (6, '1977-12-19 12:34:58.912345');
connection default;
SET debug_sync = 'now SIGNAL go';
SELECT * FROM t1;
a	b
1	2011-04-19 08:04:01.345678
2	2011-04-19 08:04:01.345678
3	2011-04-19 08:04:01.345678
4	1977-12-19 09:34:56.789123
5	1977-12-19 09:34:57.891234
6	1977-12-19 09:34:58.912345
disconnect con1;
disconnect con2;
DROP TABLE t1;
#
# Test of early activation of function defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
SET TIMESTAMP = 1317235172.987654;
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
SET TIMESTAMP = 385503754.876543;
INSERT DELAYED INTO t1 ( a ) VALUES (4), (5), (6);
FLUSH TABLE t1;
SELECT * FROM t1;
a	b
1	2011-09-28 18:39:32.987654
2	2011-09-28 18:39:32.987654
3	2011-09-28 18:39:32.987654
4	1982-03-20 20:22:34.876543
5	1982-03-20 20:22:34.876543
6	1982-03-20 20:22:34.876543
DROP TABLE t1;
SET debug_sync = 'RESET';