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

setting the version system server variable changes type of VERSION()

    XMLWordPrintable

Details

    Description

      We noticed some issues when trying to use `mariadb-devel` containers from quay.io/mariadb-foundation/mariadb-devel with mysqlclient that are not reproducible with containers from the docker hub :

      • `0` is not recognized as `Decimal`
      • `VERSION()` returns bytes instead of string
      • `SHOW FULL TABLES;` doesn't return anything

      To reproduce you can execute any query:

      import MySQLdb 
      db = MySQLdb.connect(host="mariadb-db", user="root", database="django")
      cursor = db.cursor()
      cursor.execute("SELECT VERSION()")
      

      it crashes with:

      Traceback (most recent call last):
        File "tests/runtests.py", line 6, in <module>
          cursor.execute("SELECT VERSION()")
        File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
          res = self._query(query)
        File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 321, in _query
          self._post_get_result()
        File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 355, in _post_get_result
          self._rows = self._fetch_row(0)
        File "/usr/local/lib/python3.8/site-packages/MySQLdb/cursors.py", line 328, in _fetch_row
          return self._result.fetch_row(size, self._fetch_type)
      decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
      

      when I will remove 0 to Decimal converter than VERSION() returns bytes instead of strings:

      import MySQLdb
      from MySQLdb.converters import conversions
       
      converters = conversions
      converters.pop(0, None)
       
      db = MySQLdb.connect(host="mariadb-db", user="root", database="django", conv=converters)
      cursor = db.cursor()                                                        
      cursor.execute("SELECT VERSION()")                                          
      version = cursor.fetchone()[0]
      print(type(version), version)
      

      <class 'bytes'> b'10.7.4-MariaDB-507084517fad72346ab631e3c7493154000df0a7'
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              felixx Mariusz Felisiak
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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