1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +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

@@ -160,6 +160,7 @@ def mysql roles_mapping Role 3 '' NO char 128 384 NULL NULL NULL utf8mb3 utf8mb3
def mysql roles_mapping User 2 '' NO char 128 384 NULL NULL NULL utf8mb3 utf8mb3_bin char(128) PRI select,insert,update,references NEVER NULL NO NO
def mysql servers Db 3 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL NO NO
def mysql servers Host 2 '' NO varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(2048) select,insert,update,references NEVER NULL NO NO
def mysql servers Options 10 '{}' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL NO NO
def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select,insert,update,references NEVER NULL NO NO
def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL NO NO
def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) select,insert,update,references NEVER NULL NO NO
@@ -495,6 +496,7 @@ NULL mysql servers Port int NULL NULL NULL NULL int(4)
3.0000 mysql servers Socket char 108 324 utf8mb3 utf8mb3_general_ci char(108)
3.0000 mysql servers Wrapper char 64 192 utf8mb3 utf8mb3_general_ci char(64)
3.0000 mysql servers Owner varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512)
1.0000 mysql servers Options longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext
NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6)
1.0000 mysql slow_log user_host mediumtext 16777215 16777215 utf8mb3 utf8mb3_general_ci mediumtext
NULL mysql slow_log query_time time NULL NULL NULL NULL time(6)