blob: dbbabc366833d0b15e6ab13ac6143209cf0fd3b5 (
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
|
SET sql_mode=ORACLE;
CREATE SEQUENCE s1;
SHOW CREATE SEQUENCE s1;
Table Create Table
s1 CREATE SEQUENCE "s1" start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle
SELECT s1.currval;
s1.currval
NULL
SELECT s1.nextval;
s1.nextval
1
SELECT s1.nextval;
s1.nextval
2
SELECT s1.nextval;
s1.nextval
3
EXPLAIN EXTENDED SELECT s1.nextval;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select nextval("test"."s1") AS "s1.nextval"
SELECT nextval(s1);
nextval(s1)
4
EXPLAIN EXTENDED SELECT s1.currval;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select lastval("test"."s1") AS "s1.currval"
SELECT lastval(s1);
lastval(s1)
4
DROP SEQUENCE s1;
CREATE SEQUENCE s1;
CREATE VIEW v1 AS SELECT s1.nextval AS a;
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
select nextval(`test`.`s1`) AS `a`
SELECT * FROM v1;
a
1
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select nextval("test"."s1") AS "a" latin1 latin1_swedish_ci
DROP VIEW v1;
DROP SEQUENCE s1;
CREATE SEQUENCE s1;
CREATE VIEW v1 AS SELECT s1.currval AS a;
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
select lastval(`test`.`s1`) AS `a`
SELECT * FROM v1;
a
NULL
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select lastval("test"."s1") AS "a" latin1 latin1_swedish_ci
DROP VIEW v1;
DROP SEQUENCE s1;
#
# MDEV-12533 sql_mode=ORACLE: Add support for database qualified sequence names in NEXTVAL and CURRVAL
#
CREATE SEQUENCE s1;
SELECT test.s1.nextval;
test.s1.nextval
1
SELECT test.s1.currval;
test.s1.currval
1
SELECT .s1.nextval;
.s1.nextval
2
SELECT .s1.currval;
.s1.currval
2
DROP SEQUENCE s1;
|