-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS
- Loading branch information
Alexander Barkov
committed
Dec 10, 2014
1 parent
14cfb0a
commit 822eb6c
Showing
7 changed files
with
151 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS | ||
# | ||
CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user1', HOST 'localhost', DATABASE 'test0'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
server_name username db | ||
server1 user1 test0 | ||
CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1'); | ||
Warnings: | ||
Note 1476 The foreign server, server1, you are trying to create already exists. | ||
SELECT server_name, username, db FROM mysql.servers; | ||
server_name username db | ||
server1 user1 test0 | ||
CREATE OR REPLACE SERVER server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user3', HOST 'localhost', DATABASE 'test2'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
server_name username db | ||
server1 user3 test2 | ||
DROP SERVER IF EXISTS server1; | ||
SELECT server_name, username, db FROM mysql.servers; | ||
server_name username db | ||
DROP SERVER IF EXISTS server1; | ||
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0'); | ||
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1'); | ||
ERROR HY000: The foreign server, server_1, you are trying to create already exists. | ||
CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2'); | ||
Warnings: | ||
Note 1476 The foreign server, server_1, you are trying to create already exists. | ||
SELECT server_name, username, db FROM mysql.servers; | ||
server_name username db | ||
server_1 mysqltest_1 test0 | ||
CREATE OR REPLACE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test3'); | ||
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS | ||
CREATE OR REPLACE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test4'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
server_name username db | ||
server_1 mysqltest_1 test4 | ||
DROP SERVER server_1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--echo # | ||
--echo # MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS | ||
--echo # | ||
|
||
CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user1', HOST 'localhost', DATABASE 'test0'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
CREATE OR REPLACE SERVER server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user3', HOST 'localhost', DATABASE 'test2'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
DROP SERVER IF EXISTS server1; | ||
SELECT server_name, username, db FROM mysql.servers; | ||
DROP SERVER IF EXISTS server1; | ||
|
||
|
||
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0'); | ||
--error ER_FOREIGN_SERVER_EXISTS | ||
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1'); | ||
CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
--error ER_WRONG_USAGE | ||
CREATE OR REPLACE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test3'); | ||
CREATE OR REPLACE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test4'); | ||
SELECT server_name, username, db FROM mysql.servers; | ||
DROP SERVER server_1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters