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

database() function under UNION ALL truncates results to 34 characters despite databases having up to 64 character names

    XMLWordPrintable

    Details

      Description

      From https://dba.stackexchange.com/questions/306183/why-is-my-database-name-truncated

      $ db=$(printf 'a%.0s' {1..40})
      $ echo $db
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      $ podman run -d --rm -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=$db -e MYSQL_USER=u -e MYSQL_PASSWORD=p --name m55 mariadb:5.5
      1b2c0740bf664b8a3da8071bb96234a86fe8dd5f3eb6348598f5d0c2b59ede56
       
      $ podman exec -ti m55 mysql -u u -pp  --column-type-info -e 'select database() as "database" union all select database()' $db
      Field   1:  `database`
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       VAR_STRING
      Collation:  latin1_swedish_ci (8)
      Length:     34
      Max_length: 34
      Decimals:   0
      Flags:      
       
       
      +------------------------------------+
      | database                           |
      +------------------------------------+
      | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
      | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
      +------------------------------------+
       
      $ podman exec -ti m55 mysql -u u -pp  --column-type-info -e 'select database()' $db
      Field   1:  `database()`
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       VAR_STRING
      Collation:  latin1_swedish_ci (8)
      Length:     34
      Max_length: 40
      Decimals:   31
      Flags:      
       
       
      +------------------------------------------+
      | database()                               |
      +------------------------------------------+
      | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
      +------------------------------------------+
      

      Above with 5.5 however have verified it on 10.2.

        Attachments

          Activity

            People

            Assignee:
            danblack Daniel Black
            Reporter:
            danblack Daniel Black
            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.