Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-22541

CREATE SERVER does not treat SOCKET as mutually exclusive from HOST and PORT

    XMLWordPrintable

Details

    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?

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.