1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-34716 Allow arbitrary options in CREATE SERVER

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.
This commit is contained in:
Yuchen Pei
2024-09-05 16:12:35 +10:00
parent 2345407b8c
commit d2eba35653
21 changed files with 222 additions and 19 deletions

View File

@@ -139,6 +139,7 @@ SELECT * FROM information_schema.check_constraints;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME LEVEL CHECK_CLAUSE
def db t1 CONSTRAINT_1 Table `b` > 0
def mysql global_priv Priv Column json_valid(`Priv`)
def mysql servers Options Column json_valid(`Options`)
CONNECT con1,localhost, foo,, db;
SELECT a FROM t1;
a
@@ -172,6 +173,7 @@ t CREATE TABLE `t` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
select * from information_schema.table_constraints where CONSTRAINT_TYPE='CHECK';
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
def mysql Options mysql servers CHECK
def mysql Priv mysql global_priv CHECK
def test CONSTRAINT_1 test t CHECK
def test t1 test t CHECK
@@ -181,6 +183,7 @@ def test tc_1 test t CHECK
select * from information_schema.check_constraints;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME LEVEL CHECK_CLAUSE
def mysql global_priv Priv Column json_valid(`Priv`)
def mysql servers Options Column json_valid(`Options`)
def test t CONSTRAINT_1 Table `t0` > 0
def test t t1 Column `t1` < 0
def test t t2 Column `t2` < -1