Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-238

Querying mysql.slow_log table might cause UnicodeDecodeError

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Duplicate
    • 1.0.7
    • N/A
    • DBAPI 2.0
    • None
    • 10.4.27-MariaDB-1:10.4.27+maria~deb10-log mariadb.org binary distribution
    • 3.7.3

    Description

      I tried to query the mysql.slow_log table and got this error:

      UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 6795: invalid continuation byte   
       
      SystemError: <class 'UnicodeDecodeError'> returned a result with an error set
       
      The above exception was the direct cause of the following exception:
       
      Traceback (most recent call last):
        File "./query_slow_log.py", line 13, in <module>
          main()
        File "./query_slow_log.py", line 9, in main
          cur.fetchall()
      SystemError: <method 'fetchall' of 'mariadb.connection.cursor' objects> returned a result with an error set
      

      Here is the test script:

      #!/usr/bin/env python3
       
      import mariadb
       
      def main():
          conn = mariadb.connect()
          cur = conn.cursor()
          cur.execute("SELECT * FROM mysql.slow_log")
          cur.fetchall()
          conn.close()
       
      if __name__=='__main__':
          main()
      

      Is it possible that the slow_log's sql_text column content is 'latin-1'? And since Connection.charactar_set is always utf8mb4 this error might pop up? If that's the case is there anything I can do about it?

      Attachments

        Issue Links

          Activity

            People

              georg Georg Richter
              haenige3 Haenige3
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.