-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
rename_atomic
83 lines (69 loc) · 1.13 KB
/
rename_atomic
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
statement ok
CREATE DATABASE db;
CREATE DATABASE db_new;
statement ok
BEGIN;
ALTER DATABASE db RENAME TO db_old;
ALTER DATABASE db_new RENAME TO db;
COMMIT;
statement ok
BEGIN;
DROP DATABASE db;
ALTER DATABASE db_old RENAME TO db;
COMMIT;
statement ok
BEGIN;
ALTER DATABASE db RENAME TO db_old;
CREATE DATABASE db;
COMMIT;
statement ok
BEGIN;
DROP DATABASE db;
CREATE DATABASE db;
COMMIT;
statement ok
CREATE SCHEMA sc;
CREATE SCHEMA sc_new;
statement ok
BEGIN;
ALTER SCHEMA sc RENAME TO sc_old;
ALTER SCHEMA sc_new RENAME TO sc;
COMMIT;
statement ok
BEGIN;
DROP SCHEMA sc;
ALTER SCHEMA sc_old RENAME TO sc;
COMMIT;
statement ok
BEGIN;
ALTER SCHEMA sc RENAME TO sc_old;
CREATE SCHEMA sc;
COMMIT;
statement ok
BEGIN;
DROP SCHEMA sc;
CREATE SCHEMA sc;
COMMIT;
statement ok
CREATE VIEW v AS SELECT 1;
CREATE VIEW v_new AS SELECT 1;
statement ok
BEGIN;
ALTER VIEW v RENAME TO v_old;
ALTER VIEW v_new RENAME TO v;
COMMIT;
statement ok
BEGIN;
DROP VIEW v;
ALTER VIEW v_old RENAME TO v;
COMMIT;
statement ok
BEGIN;
ALTER VIEW v RENAME TO v_old;
CREATE VIEW v AS SELECT 1;
COMMIT;
statement ok
BEGIN;
DROP VIEW v;
CREATE VIEW v AS SELECT 1;
COMMIT;