mirror of
https://github.com/MariaDB/server.git
synced 2025-02-23 05:43:08 +01:00

The existing syntax for CREATE SERVER CREATE [OR REPLACE] SERVER [IF NOT EXISTS] server_name FOREIGN DATA WRAPPER wrapper_name OPTIONS (option [, option] ...) option: { HOST character-literal | DATABASE character-literal | USER character-literal | PASSWORD character-literal | SOCKET character-literal | OWNER character-literal | PORT numeric-literal } With this change we have: option: { HOST character-literal | DATABASE character-literal | USER character-literal | PASSWORD character-literal | SOCKET character-literal | OWNER character-literal | PORT numeric-literal | PORT quoted-numerical-literal | identifier character-literal} We store these options as a JSON field in the mysql.servers system table. We retain the restriction that PORT needs to be a number, but also allow it to be a quoted number, so that SHOW CREATE SERVER can be used for dumping. Without an accompanied implementation of SHOW CREATE SERVER, some mysqldump tests will fail. Therefore this commit should be immediately followed by the one implementating SHOW CREATE SERVER, with testing covering both.
28 lines
665 B
Text
28 lines
665 B
Text
connection node_2;
|
|
connection node_1;
|
|
connection node_1;
|
|
# On node_1
|
|
CREATE SERVER s1
|
|
FOREIGN DATA WRAPPER mysql
|
|
OPTIONS (HOST 'foo');
|
|
connection node_2;
|
|
# On node_2
|
|
SELECT * FROM mysql.servers;
|
|
Server_name Host Db Username Password Port Socket Wrapper Owner Options
|
|
s1 foo 3306 mysql {"HOST": "foo"}
|
|
ALTER SERVER s1
|
|
OPTIONS (HOST 'bar');
|
|
connection node_1;
|
|
# On node_1
|
|
SELECT * FROM mysql.servers;
|
|
Server_name Host Db Username Password Port Socket Wrapper Owner Options
|
|
s1 bar 3306 mysql {"HOST": "bar"}
|
|
DROP SERVER s1;
|
|
connection node_2;
|
|
# On node_2
|
|
SELECT COUNT(*)=0 FROM mysql.servers;
|
|
COUNT(*)=0
|
|
1
|
|
disconnect node_2;
|
|
disconnect node_1;
|
|
# End of test
|