[MDEV-22541] CREATE SERVER does not treat SOCKET as mutually exclusive from HOST and PORT Created: 2020-05-13  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - Federated, Storage Engine - Spider
Affects Version/s: 10.2.31, 10.3.22, 10.4.12, 10.5.2
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-27106 Spider: specify connection to data no... Closed

 Description   

The CREATE SERVER statement allows you to set the HOST and PORT options if the server is remote, but it also allows you to set the SOCKET option if the server is local.

Generally speaking, you can't use the SOCKET option and also use the HOST and PORT options.

However, the server will happily accept all 3 options at the same time. For example, this succeeds:

CREATE OR REPLACE SERVER hq_server 
   FOREIGN DATA WRAPPER mariadb
OPTIONS ( 
  HOST '127.0.0.1', 
  DATABASE 'hq_sales',
  USER 'spider_user',
  PASSWORD 'password',
  PORT 3307,
  SOCKET '/var/lib/mysql/mysql.sock'
);

And all 3 values are written to the mysql.servers table:

MariaDB [(none)]> SELECT * FROM mysql.servers;
+-------------+-----------+----------+-------------+----------+------+---------------------------+---------+-------+
| Server_name | Host      | Db       | Username    | Password | Port | Socket                    | Wrapper | Owner |
+-------------+-----------+----------+-------------+----------+------+---------------------------+---------+-------+
| hq_server   | 127.0.0.1 | hq_sales | spider_user | password | 3307 | /var/lib/mysql/mysql.sock | mariadb |       |
+-------------+-----------+----------+-------------+----------+------+---------------------------+---------+-------+
1 row in set (0.001 sec)

Would it make sense to throw an error or warning if the SOCKET option is defined and the HOST and PORT options are also defined?


Generated at Thu Feb 08 09:15:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.