~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/r/rpl_udf.result

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
stop slave;
 
2
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
3
reset master;
 
4
reset slave;
 
5
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 
6
start slave;
 
7
set binlog_format=row;
 
8
drop table if exists t1;
 
9
"*** Test 1) Test UDFs via loadable libraries ***
 
10
"Running on the master"
 
11
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
 
12
affected rows: 0
 
13
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
 
14
affected rows: 0
 
15
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
 
16
ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
 
17
SELECT * FROM mysql.func ORDER BY name;
 
18
name    ret     dl      type
 
19
myfunc_double   1       UDF_LIB function
 
20
myfunc_int      2       UDF_LIB function
 
21
affected rows: 2
 
22
"Running on the slave"
 
23
SELECT * FROM mysql.func ORDER BY name;
 
24
name    ret     dl      type
 
25
myfunc_double   1       UDF_LIB function
 
26
myfunc_int      2       UDF_LIB function
 
27
affected rows: 2
 
28
"Running on the master"
 
29
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
 
30
affected rows: 0
 
31
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
 
32
affected rows: 1
 
33
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
 
34
affected rows: 1
 
35
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
 
36
affected rows: 1
 
37
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
 
38
affected rows: 1
 
39
SELECT * FROM t1 ORDER BY sum;
 
40
sum     price
 
41
1       48.5
 
42
10      48.75
 
43
100     48.6
 
44
200     49
 
45
affected rows: 4
 
46
"Running on the slave"
 
47
SELECT * FROM t1 ORDER BY sum;
 
48
sum     price
 
49
1       48.5
 
50
10      48.75
 
51
100     48.6
 
52
200     49
 
53
affected rows: 4
 
54
SELECT myfunc_int(25);
 
55
myfunc_int(25)
 
56
25
 
57
affected rows: 1
 
58
SELECT myfunc_double(75.00);
 
59
myfunc_double(75.00)
 
60
50.00
 
61
affected rows: 1
 
62
"Running on the master"
 
63
DROP FUNCTION myfunc_double;
 
64
affected rows: 0
 
65
DROP FUNCTION myfunc_int;
 
66
affected rows: 0
 
67
SELECT * FROM mysql.func ORDER BY name;
 
68
name    ret     dl      type
 
69
affected rows: 0
 
70
"Running on the slave"
 
71
SELECT * FROM mysql.func ORDER BY name;
 
72
name    ret     dl      type
 
73
affected rows: 0
 
74
"Running on the master"
 
75
DROP TABLE t1;
 
76
affected rows: 0
 
77
"*** Test 2) Test UDFs with SQL body ***
 
78
"Running on the master"
 
79
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
 
80
affected rows: 0
 
81
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
 
82
affected rows: 0
 
83
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
84
db      name    type    param_list      body    comment
 
85
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 
 
86
test    myfuncsql_int   FUNCTION        i INT   RETURN i        
 
87
affected rows: 2
 
88
"Running on the slave"
 
89
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
90
db      name    type    param_list      body    comment
 
91
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 
 
92
test    myfuncsql_int   FUNCTION        i INT   RETURN i        
 
93
affected rows: 2
 
94
"Running on the master"
 
95
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
 
96
affected rows: 0
 
97
INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
 
98
affected rows: 1
 
99
INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
 
100
affected rows: 1
 
101
INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
 
102
affected rows: 1
 
103
INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
 
104
affected rows: 1
 
105
SELECT * FROM t1 ORDER BY sum;
 
106
sum     price
 
107
1       1000
 
108
10      10
 
109
100     100
 
110
200     50
 
111
affected rows: 4
 
112
"Running on the slave"
 
113
SELECT * FROM t1 ORDER BY sum;
 
114
sum     price
 
115
1       1000
 
116
10      10
 
117
100     100
 
118
200     50
 
119
affected rows: 4
 
120
"Running on the master"
 
121
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
 
122
affected rows: 0
 
123
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
 
124
affected rows: 0
 
125
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
126
db      name    type    param_list      body    comment
 
127
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 This was altered.
 
128
test    myfuncsql_int   FUNCTION        i INT   RETURN i        This was altered.
 
129
affected rows: 2
 
130
"Running on the slave"
 
131
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
132
db      name    type    param_list      body    comment
 
133
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 This was altered.
 
134
test    myfuncsql_int   FUNCTION        i INT   RETURN i        This was altered.
 
135
affected rows: 2
 
136
SELECT myfuncsql_int(25);
 
137
myfuncsql_int(25)
 
138
25
 
139
affected rows: 1
 
140
SELECT myfuncsql_double(75.00);
 
141
myfuncsql_double(75.00)
 
142
150
 
143
affected rows: 1
 
144
"Running on the master"
 
145
DROP FUNCTION myfuncsql_double;
 
146
affected rows: 0
 
147
DROP FUNCTION myfuncsql_int;
 
148
affected rows: 0
 
149
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
150
db      name    type    param_list      body    comment
 
151
affected rows: 0
 
152
"Running on the slave"
 
153
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
154
db      name    type    param_list      body    comment
 
155
affected rows: 0
 
156
"Running on the master"
 
157
DROP TABLE t1;
 
158
affected rows: 0
 
159
set binlog_format=statement;
 
160
drop table if exists t1;
 
161
"*** Test 1) Test UDFs via loadable libraries ***
 
162
"Running on the master"
 
163
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB";
 
164
affected rows: 0
 
165
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
 
166
affected rows: 0
 
167
CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
 
168
ERROR HY000: Can't find symbol 'myfunc_nonexist' in library
 
169
SELECT * FROM mysql.func ORDER BY name;
 
170
name    ret     dl      type
 
171
myfunc_double   1       UDF_LIB function
 
172
myfunc_int      2       UDF_LIB function
 
173
affected rows: 2
 
174
"Running on the slave"
 
175
SELECT * FROM mysql.func ORDER BY name;
 
176
name    ret     dl      type
 
177
myfunc_double   1       UDF_LIB function
 
178
myfunc_int      2       UDF_LIB function
 
179
affected rows: 2
 
180
"Running on the master"
 
181
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
 
182
affected rows: 0
 
183
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
 
184
Warnings:
 
185
Note    1592    Statement may not be safe to log in statement format.
 
186
affected rows: 1
 
187
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
 
188
Warnings:
 
189
Note    1592    Statement may not be safe to log in statement format.
 
190
affected rows: 1
 
191
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
 
192
Warnings:
 
193
Note    1592    Statement may not be safe to log in statement format.
 
194
affected rows: 1
 
195
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
 
196
Warnings:
 
197
Note    1592    Statement may not be safe to log in statement format.
 
198
affected rows: 1
 
199
SELECT * FROM t1 ORDER BY sum;
 
200
sum     price
 
201
1       48.5
 
202
10      48.75
 
203
100     48.6
 
204
200     49
 
205
affected rows: 4
 
206
"Running on the slave"
 
207
SELECT * FROM t1 ORDER BY sum;
 
208
sum     price
 
209
1       48.5
 
210
10      48.75
 
211
100     48.6
 
212
200     49
 
213
affected rows: 4
 
214
SELECT myfunc_int(25);
 
215
myfunc_int(25)
 
216
25
 
217
affected rows: 1
 
218
SELECT myfunc_double(75.00);
 
219
myfunc_double(75.00)
 
220
50.00
 
221
affected rows: 1
 
222
"Running on the master"
 
223
DROP FUNCTION myfunc_double;
 
224
affected rows: 0
 
225
DROP FUNCTION myfunc_int;
 
226
affected rows: 0
 
227
SELECT * FROM mysql.func ORDER BY name;
 
228
name    ret     dl      type
 
229
affected rows: 0
 
230
"Running on the slave"
 
231
SELECT * FROM mysql.func ORDER BY name;
 
232
name    ret     dl      type
 
233
affected rows: 0
 
234
"Running on the master"
 
235
DROP TABLE t1;
 
236
affected rows: 0
 
237
"*** Test 2) Test UDFs with SQL body ***
 
238
"Running on the master"
 
239
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
 
240
affected rows: 0
 
241
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
 
242
affected rows: 0
 
243
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
244
db      name    type    param_list      body    comment
 
245
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 
 
246
test    myfuncsql_int   FUNCTION        i INT   RETURN i        
 
247
affected rows: 2
 
248
"Running on the slave"
 
249
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
250
db      name    type    param_list      body    comment
 
251
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 
 
252
test    myfuncsql_int   FUNCTION        i INT   RETURN i        
 
253
affected rows: 2
 
254
"Running on the master"
 
255
CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM;
 
256
affected rows: 0
 
257
INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
 
258
affected rows: 1
 
259
INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00));
 
260
affected rows: 1
 
261
INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00));
 
262
affected rows: 1
 
263
INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00));
 
264
affected rows: 1
 
265
SELECT * FROM t1 ORDER BY sum;
 
266
sum     price
 
267
1       1000
 
268
10      10
 
269
100     100
 
270
200     50
 
271
affected rows: 4
 
272
"Running on the slave"
 
273
SELECT * FROM t1 ORDER BY sum;
 
274
sum     price
 
275
1       1000
 
276
10      10
 
277
100     100
 
278
200     50
 
279
affected rows: 4
 
280
"Running on the master"
 
281
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
 
282
affected rows: 0
 
283
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
 
284
affected rows: 0
 
285
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
286
db      name    type    param_list      body    comment
 
287
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 This was altered.
 
288
test    myfuncsql_int   FUNCTION        i INT   RETURN i        This was altered.
 
289
affected rows: 2
 
290
"Running on the slave"
 
291
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
292
db      name    type    param_list      body    comment
 
293
test    myfuncsql_double        FUNCTION        d DOUBLE        RETURN d * 2.00 This was altered.
 
294
test    myfuncsql_int   FUNCTION        i INT   RETURN i        This was altered.
 
295
affected rows: 2
 
296
SELECT myfuncsql_int(25);
 
297
myfuncsql_int(25)
 
298
25
 
299
affected rows: 1
 
300
SELECT myfuncsql_double(75.00);
 
301
myfuncsql_double(75.00)
 
302
150
 
303
affected rows: 1
 
304
"Running on the master"
 
305
DROP FUNCTION myfuncsql_double;
 
306
affected rows: 0
 
307
DROP FUNCTION myfuncsql_int;
 
308
affected rows: 0
 
309
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
310
db      name    type    param_list      body    comment
 
311
affected rows: 0
 
312
"Running on the slave"
 
313
SELECT db, name, type,  param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
 
314
db      name    type    param_list      body    comment
 
315
affected rows: 0
 
316
"Running on the master"
 
317
DROP TABLE t1;
 
318
affected rows: 0