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

Structured access to error information (schema, table, and constraint names)

    XMLWordPrintable

Details

    Description

      ERR_Packet currently only provides an error code and a user-facing message. This means that if the client wants to figure out exactly what failed then the only option is to parse the error message, or probe with more queries. This can be tricky and is not robust.

      One reason to want this is to take a different action based on which constraint failed. Another is to disambiguate errors from multi-schema queries, since the error message usually doesn't contain the schema name.

      To make this possible, it would be nice to expand ERR_PACKET with information such as (1) failed constraint name, (2) relevant schema, (3) affected tables. This likely needs to be restricted behind a connection flag since it seems ERR_PACKET is not extensible.

      Postgres provides a number of structured error fields https://www.postgresql.org/docs/current/protocol-error-fields.html:

      • Severity
      • Error code (already exists in MariaDB)
      • Message (already exists in MariaDB)
      • Detailed message
      • Hint
      • Position of the error
      • Internal query and internal position (e.g. point to where exactly an error occurred in a stored procedure)
      • Call stack
      • Schema name
      • Table name
      • Column name
      • Data type name
      • Constraint name
      • File name
      • Line number
      • Routine name

      I am most interested in having schema/table/column/constraint, but a number of these would be nice. E.g. hints and a call stack are great for debugging, moving source location out of the message would clean up syntax errors.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tgross35 Trevor Gross
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.