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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
|
# ========== parameters.1 ==========
USE INFORMATION_SCHEMA;
SHOW CREATE TABLE INFORMATION_SCHEMA.PARAMETERS;
Table Create Table
PARAMETERS CREATE TEMPORARY TABLE `PARAMETERS` (
`SPECIFIC_CATALOG` varchar(512) NOT NULL,
`SPECIFIC_SCHEMA` varchar(64) NOT NULL,
`SPECIFIC_NAME` varchar(64) NOT NULL,
`ORDINAL_POSITION` int(21) NOT NULL,
`PARAMETER_MODE` varchar(5),
`PARAMETER_NAME` varchar(64),
`DATA_TYPE` varchar(64) NOT NULL,
`CHARACTER_MAXIMUM_LENGTH` int(21),
`CHARACTER_OCTET_LENGTH` int(21),
`NUMERIC_PRECISION` int(21),
`NUMERIC_SCALE` int(21),
`DATETIME_PRECISION` bigint(21) unsigned,
`CHARACTER_SET_NAME` varchar(64),
`COLLATION_NAME` varchar(64),
`DTD_IDENTIFIER` longtext NOT NULL,
`ROUTINE_TYPE` varchar(9) NOT NULL
) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
SELECT * FROM information_schema.columns
WHERE table_schema = 'information_schema'
AND table_name = 'parameters'
ORDER BY ordinal_position;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_CATALOG
ORDINAL_POSITION 1
COLUMN_DEFAULT NULL
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 512
CHARACTER_OCTET_LENGTH 1536
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(512)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_SCHEMA
ORDINAL_POSITION 2
COLUMN_DEFAULT NULL
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
CHARACTER_OCTET_LENGTH 192
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(64)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_NAME
ORDINAL_POSITION 3
COLUMN_DEFAULT NULL
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
CHARACTER_OCTET_LENGTH 192
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(64)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME ORDINAL_POSITION
ORDINAL_POSITION 4
COLUMN_DEFAULT NULL
IS_NULLABLE NO
DATA_TYPE int
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION 10
NUMERIC_SCALE 0
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
COLUMN_TYPE int(21)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME PARAMETER_MODE
ORDINAL_POSITION 5
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 5
CHARACTER_OCTET_LENGTH 15
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(5)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME PARAMETER_NAME
ORDINAL_POSITION 6
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
CHARACTER_OCTET_LENGTH 192
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(64)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME DATA_TYPE
ORDINAL_POSITION 7
COLUMN_DEFAULT NULL
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
CHARACTER_OCTET_LENGTH 192
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(64)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_MAXIMUM_LENGTH
ORDINAL_POSITION 8
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE int
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION 10
NUMERIC_SCALE 0
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
COLUMN_TYPE int(21)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_OCTET_LENGTH
ORDINAL_POSITION 9
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE int
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION 10
NUMERIC_SCALE 0
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
COLUMN_TYPE int(21)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME NUMERIC_PRECISION
ORDINAL_POSITION 10
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE int
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION 10
NUMERIC_SCALE 0
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
COLUMN_TYPE int(21)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME NUMERIC_SCALE
ORDINAL_POSITION 11
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE int
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION 10
NUMERIC_SCALE 0
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
COLUMN_TYPE int(21)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME DATETIME_PRECISION
ORDINAL_POSITION 12
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE bigint
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION 20
NUMERIC_SCALE 0
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
COLUMN_TYPE bigint(21) unsigned
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_SET_NAME
ORDINAL_POSITION 13
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
CHARACTER_OCTET_LENGTH 192
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(64)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME COLLATION_NAME
ORDINAL_POSITION 14
COLUMN_DEFAULT NULL
IS_NULLABLE YES
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 64
CHARACTER_OCTET_LENGTH 192
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(64)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME DTD_IDENTIFIER
ORDINAL_POSITION 15
COLUMN_DEFAULT NULL
IS_NULLABLE NO
DATA_TYPE longtext
CHARACTER_MAXIMUM_LENGTH 4294967295
CHARACTER_OCTET_LENGTH 4294967295
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE longtext
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME PARAMETERS
COLUMN_NAME ROUTINE_TYPE
ORDINAL_POSITION 16
COLUMN_DEFAULT NULL
IS_NULLABLE NO
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 9
CHARACTER_OCTET_LENGTH 27
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME utf8mb3
COLLATION_NAME utf8mb3_general_ci
COLUMN_TYPE varchar(9)
COLUMN_KEY
EXTRA
PRIVILEGES #
COLUMN_COMMENT
IS_GENERATED NEVER
GENERATION_EXPRESSION NULL
DESCRIBE INFORMATION_SCHEMA.PARAMETERS;
Field Type Null Key Default Extra
SPECIFIC_CATALOG varchar(512) NO NULL
SPECIFIC_SCHEMA varchar(64) NO NULL
SPECIFIC_NAME varchar(64) NO NULL
ORDINAL_POSITION int(21) NO NULL
PARAMETER_MODE varchar(5) YES NULL
PARAMETER_NAME varchar(64) YES NULL
DATA_TYPE varchar(64) NO NULL
CHARACTER_MAXIMUM_LENGTH int(21) YES NULL
CHARACTER_OCTET_LENGTH int(21) YES NULL
NUMERIC_PRECISION int(21) YES NULL
NUMERIC_SCALE int(21) YES NULL
DATETIME_PRECISION bigint(21) unsigned YES NULL
CHARACTER_SET_NAME varchar(64) YES NULL
COLLATION_NAME varchar(64) YES NULL
DTD_IDENTIFIER longtext NO NULL
ROUTINE_TYPE varchar(9) NO NULL
# ========== parameters.2 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func1 (s char(20) RETURNS CHAR(50)
RETURN CONCAT('Hello', ,s,'!');
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RETURNS CHAR(50)
RETURN CONCAT('Hello', ,s,'!')' at line 1
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
# ========== parameters.3 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func1 (s char(20)) RETURNS CHAR(50)
RETURN CONCAT('Hello, ',s,'!');
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func1 0 NULL NULL char 50 50 NULL NULL NULL latin1 latin1_swedish_ci char(50) FUNCTION
def i_s_parameters_test test_func1 1 IN s char 20 20 NULL NULL NULL latin1 latin1_swedish_ci char(20) FUNCTION
DROP FUNCTION test_func1;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
# ========== parameters.4 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE PROCEDURE testproc (IN param1 INT)
BEGIN
SELECT 2+2 as param1;
END;
//
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'testproc';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test testproc 1 IN param1 int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# ========== parameters.5 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE PROCEDURE test_proc(INOUT P INT) SET @x=P*2;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_proc';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_proc 1 INOUT P int NULL NULL 10 0 NULL NULL NULL int(11) PROCEDURE
# ========== parameters.6 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE PROCEDURE test_proc(OUT p VARCHAR(10)) SET P='test';
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_proc';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_proc 1 OUT p varchar 10 10 NULL NULL NULL latin1 latin1_swedish_ci varchar(10) PROCEDURE
# ========== parameters.7 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func1 (s char(20), t char(20)) RETURNS CHAR(40)
RETURN CONCAT(s,t);
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func1 0 NULL NULL char 40 40 NULL NULL NULL latin1 latin1_swedish_ci char(40) FUNCTION
def i_s_parameters_test test_func1 1 IN s char 20 20 NULL NULL NULL latin1 latin1_swedish_ci char(20) FUNCTION
def i_s_parameters_test test_func1 2 IN t char 20 20 NULL NULL NULL latin1 latin1_swedish_ci char(20) FUNCTION
# ========== parameters.8 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func1 (s char(20)) RETURNS CHAR(50)
RETURN CONCAT('Hello, ',s,'!');
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func1 0 NULL NULL char 50 50 NULL NULL NULL latin1 latin1_swedish_ci char(50) FUNCTION
def i_s_parameters_test test_func1 1 IN s char 20 20 NULL NULL NULL latin1 latin1_swedish_ci char(20) FUNCTION
# ========== parameters.9 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func2 (s int) RETURNS INT RETURN s*2;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func2';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func2 0 NULL NULL int NULL NULL 10 0 NULL NULL NULL int(11) FUNCTION
def i_s_parameters_test test_func2 1 IN s int NULL NULL 10 0 NULL NULL NULL int(11) FUNCTION
# ========== parameters.10 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func5 (s date) RETURNS TIMESTAMP
RETURN CURRENT_TIMESTAMP;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func5 0 NULL NULL timestamp NULL NULL NULL NULL 0 NULL NULL timestamp FUNCTION
def i_s_parameters_test test_func5 1 IN s date NULL NULL NULL NULL NULL NULL NULL date FUNCTION
# ========== parameters.11 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func5 (s date) RETURNS TIMESTAMP
RETURN CURRENT_TIMESTAMP;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func5 0 NULL NULL timestamp NULL NULL NULL NULL 0 NULL NULL timestamp FUNCTION
def i_s_parameters_test test_func5 1 IN s date NULL NULL NULL NULL NULL NULL NULL date FUNCTION
ALTER FUNCTION test_func5 COMMENT 'new comment added';
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func5 0 NULL NULL timestamp NULL NULL NULL NULL 0 NULL NULL timestamp FUNCTION
def i_s_parameters_test test_func5 1 IN s date NULL NULL NULL NULL NULL NULL NULL date FUNCTION
# ========== parameters.12 ==========
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test CHARACTER SET utf8;
USE i_s_parameters_test;
CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30)
RETURN CONCAT('XYZ, ' ,s);
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
SPECIFIC_CATALOG SPECIFIC_SCHEMA SPECIFIC_NAME ORDINAL_POSITION PARAMETER_MODE PARAMETER_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_TYPE
def i_s_parameters_test test_func5 0 NULL NULL varchar 30 90 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(30) FUNCTION
def i_s_parameters_test test_func5 1 IN s char 20 60 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(20) FUNCTION
DROP DATABASE i_s_parameters_test;
USE test;
#
# Start of 10.3 tests
#
#
# MDEV-15416 Crash when reading I_S.PARAMETERS
#
CREATE PROCEDURE p1(a0 TYPE OF t1.a,
a1 TYPE OF test.t1.a,
b0 ROW TYPE OF t1,
b1 ROW TYPE OF test.t1,
c ROW(a INT,b DOUBLE))
BEGIN
END;
$$
SELECT *, '--------' FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'p1';
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA test
SPECIFIC_NAME p1
ORDINAL_POSITION 1
PARAMETER_MODE IN
PARAMETER_NAME a0
DATA_TYPE TYPE OF
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
DTD_IDENTIFIER TYPE OF `t1`.`a`
ROUTINE_TYPE PROCEDURE
-------- --------
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA test
SPECIFIC_NAME p1
ORDINAL_POSITION 2
PARAMETER_MODE IN
PARAMETER_NAME a1
DATA_TYPE TYPE OF
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
DTD_IDENTIFIER TYPE OF `test`.`t1`.`a`
ROUTINE_TYPE PROCEDURE
-------- --------
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA test
SPECIFIC_NAME p1
ORDINAL_POSITION 3
PARAMETER_MODE IN
PARAMETER_NAME b0
DATA_TYPE ROW TYPE OF
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
DTD_IDENTIFIER ROW TYPE OF `t1`
ROUTINE_TYPE PROCEDURE
-------- --------
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA test
SPECIFIC_NAME p1
ORDINAL_POSITION 4
PARAMETER_MODE IN
PARAMETER_NAME b1
DATA_TYPE ROW TYPE OF
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
DTD_IDENTIFIER ROW TYPE OF `test`.`t1`
ROUTINE_TYPE PROCEDURE
-------- --------
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA test
SPECIFIC_NAME p1
ORDINAL_POSITION 5
PARAMETER_MODE IN
PARAMETER_NAME c
DATA_TYPE ROW
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
DTD_IDENTIFIER ROW
ROUTINE_TYPE PROCEDURE
-------- --------
DROP PROCEDURE p1;
#
# MDEV-20609 Full table scan in INFORMATION_SCHEMA.PARAMETERS/ROUTINES
#
DROP DATABASE IF EXISTS i_s_parameters_test;
CREATE DATABASE i_s_parameters_test;
USE i_s_parameters_test;
CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30)
RETURN CONCAT('XYZ, ' ,s);
#
# We cannot use the index due to missing condition on SPECIFIC_SCHEMA,
# but we will use SPECIFIC_NAME for filtering records from mysql.proc
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_NAME = 'test_func5';
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA i_s_parameters_test
SPECIFIC_NAME test_func5
ORDINAL_POSITION 0
PARAMETER_MODE NULL
PARAMETER_NAME NULL
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 30
CHARACTER_OCTET_LENGTH 30
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME latin1
COLLATION_NAME latin1_swedish_ci
DTD_IDENTIFIER varchar(30)
ROUTINE_TYPE FUNCTION
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA i_s_parameters_test
SPECIFIC_NAME test_func5
ORDINAL_POSITION 1
PARAMETER_MODE IN
PARAMETER_NAME s
DATA_TYPE char
CHARACTER_MAXIMUM_LENGTH 20
CHARACTER_OCTET_LENGTH 20
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME latin1
COLLATION_NAME latin1_swedish_ci
DTD_IDENTIFIER char(20)
ROUTINE_TYPE FUNCTION
SHOW STATUS LIKE 'handler_read%next';
Variable_name Value
Handler_read_next count_routines
Handler_read_rnd_next 3
#
# We cannot use the index due to CONCAT(), and filtering by SPECIFIC_NAME
# does not work either since SPECIFIC_NAME = 'not_existing_proc'. See
# the difference in counters in comparison to the previous test
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE CONCAT(SPECIFIC_SCHEMA) = 'i_s_parameters_test'
AND SPECIFIC_NAME = 'not_existing_proc';
SHOW STATUS LIKE 'handler_read%next';
Variable_name Value
Handler_read_next count_routines
Handler_read_rnd_next 1
#
# Now the index must be used
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test'
AND SPECIFIC_NAME = 'test_func5';
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA i_s_parameters_test
SPECIFIC_NAME test_func5
ORDINAL_POSITION 0
PARAMETER_MODE NULL
PARAMETER_NAME NULL
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 30
CHARACTER_OCTET_LENGTH 30
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME latin1
COLLATION_NAME latin1_swedish_ci
DTD_IDENTIFIER varchar(30)
ROUTINE_TYPE FUNCTION
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA i_s_parameters_test
SPECIFIC_NAME test_func5
ORDINAL_POSITION 1
PARAMETER_MODE IN
PARAMETER_NAME s
DATA_TYPE char
CHARACTER_MAXIMUM_LENGTH 20
CHARACTER_OCTET_LENGTH 20
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME latin1
COLLATION_NAME latin1_swedish_ci
DTD_IDENTIFIER char(20)
ROUTINE_TYPE FUNCTION
SHOW STATUS LIKE 'handler_read%next';
Variable_name Value
Handler_read_next 1
Handler_read_rnd_next 3
#
# Using the first key part of the index
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test';
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA i_s_parameters_test
SPECIFIC_NAME test_func5
ORDINAL_POSITION 0
PARAMETER_MODE NULL
PARAMETER_NAME NULL
DATA_TYPE varchar
CHARACTER_MAXIMUM_LENGTH 30
CHARACTER_OCTET_LENGTH 30
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME latin1
COLLATION_NAME latin1_swedish_ci
DTD_IDENTIFIER varchar(30)
ROUTINE_TYPE FUNCTION
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA i_s_parameters_test
SPECIFIC_NAME test_func5
ORDINAL_POSITION 1
PARAMETER_MODE IN
PARAMETER_NAME s
DATA_TYPE char
CHARACTER_MAXIMUM_LENGTH 20
CHARACTER_OCTET_LENGTH 20
NUMERIC_PRECISION NULL
NUMERIC_SCALE NULL
DATETIME_PRECISION NULL
CHARACTER_SET_NAME latin1
COLLATION_NAME latin1_swedish_ci
DTD_IDENTIFIER char(20)
ROUTINE_TYPE FUNCTION
SHOW STATUS LIKE 'handler_read%next';
Variable_name Value
Handler_read_next 1
Handler_read_rnd_next 3
#
# Test non-latin letters in procedure name
SET NAMES koi8r;
CREATE PROCEDURE `процедурка`(a INT) SELECT a;
#
# The index must be used
FLUSH STATUS;
SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test'
AND SPECIFIC_NAME = 'процедурка';
SPECIFIC_CATALOG def
SPECIFIC_SCHEMA i_s_parameters_test
SPECIFIC_NAME процедурка
ORDINAL_POSITION 1
PARAMETER_MODE IN
PARAMETER_NAME a
DATA_TYPE int
CHARACTER_MAXIMUM_LENGTH NULL
CHARACTER_OCTET_LENGTH NULL
NUMERIC_PRECISION 10
NUMERIC_SCALE 0
DATETIME_PRECISION NULL
CHARACTER_SET_NAME NULL
COLLATION_NAME NULL
DTD_IDENTIFIER int(11)
ROUTINE_TYPE PROCEDURE
SHOW STATUS LIKE 'handler_read%next';
Variable_name Value
Handler_read_next 1
Handler_read_rnd_next 2
SELECT COUNT(*) FROM information_schema.PARAMETERS
WHERE SPECIFIC_CATALOG = NULL;
COUNT(*)
#
DROP DATABASE i_s_parameters_test;
USE test;
|