[0.45.1] Unable to retrieve/ add/ view users on Postgres application db

After adding a user, I always get the following error.
The application database is Postgres, not H2. This is not a known issue.

Output of user->personal-collection does not match schema: e[0;33m (not ("instance of a Collection" nil)) e[0m

{
  "browser-info": {
    "language": "ja",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.17+8",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.17",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.17+8",
    "os.name": "Linux",
    "os.version": "5.15.0-1026-aws",
    "user.language": "en",
    "user.timezone": "Asia/Tokyo"
  },
  "metabase-info": {
    "databases": [
      "bigquery-cloud-sdk"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "10.21 (Debian 10.21-1.pgdg90+1)"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.5.0"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2022-12-07",
      "tag": "v0.45.1",
      "branch": "release-x.45.x",
      "hash": "019d31c"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Hi @t.kojima
It's generating the same errors as https://github.com/metabase/metabase/issues/13890/https://github.com/metabase/metabase/issues/10738, which would seem to indicate that there's already another user with that email or using a name that can't be handled.

Check your Postgres table core_user.
And include the full output of the table databasechangelog

@flamber
Thanks for reply,

I have identified the cause of the error.

When registering a user in the browser, if using 2-byte characters (e.g. Japanese), they are percent encoded.
The column "first_name" is only allowed up to 254 bytes, but a percent-encoded string could exceed that.

Unfortunately, I am not familiar with Java and cannot directly contribute to the code fix.

How to reproduce the issue:
When registering a user, set the following for the first name.
ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚

 ["BatchUpdateException:"
  "Message: Batch entry 0 UPDATE \"collection\" SET \"name\" = 'ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใ‚ใฎใƒ‘ใƒผใ‚ฝใƒŠใƒซใ‚ณใƒฌใ‚ฏใ‚ทใƒงใƒณ', \"slug\" = '%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%82%E3%81%AE%E3%83%8F%E3%82%9A%E3%83%BC%E3%82%BD%E3%83%8A%E3%83%AB%E3%82%B3%E3%83%AC%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3' WHERE \"id\" = 27 was aborted: ERROR: value too long for type character varying(254)  Call getNextException to see other errors in the batch."
  "SQLState: 22001"
  "Error Code: 0"
  "PSQLException:"
  "Message: ERROR: value too long for type character varying(254)"
  "SQLState: 22001"
  "Error Code: 0"]}
1 Like