Moodle
  1. Moodle
  2. MDL-33748

XMLDB: xmldb_field constant CHAR_MAX_LENGTH value too low

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_23_STABLE
    • Rank:
      41781

      Description

      See MDL-32112.

      I'd like to ask about the char/varchar column limit value CHAR_MAX_LENGTH, if I may. Why 1333? Especially in view of the docblock mentioning the four most likely to be used DB engines having a max column length well above 1333.

      Please forgive for my ignorance if it's otherwise, but is 1333 a magic number?

      I've written an enrollment plugin that makes use of staging tables to store IMS-based messages. The IMS spec has the course description max length at 2048.

      Rather than have to create a text/clob column, it is preferable I think to create a varchar2 column. I realize the likelihood of an IMS course description exceeding 1000 or so characters is slim, but not everybody adheres the specs.

      I'd like to suggest the CHAR_MAX_LENGTH value be adjusted to 4000 to match the Oracle max length.

        Activity

        Hide
        Petr Škoda added a comment -

        Hi, blame Oracle for this restriction, I personally vote to drop support for this database that ignores basic SQL standards, but I guess that will not be accepted. closing, sorry

        Show
        Petr Škoda added a comment - Hi, blame Oracle for this restriction, I personally vote to drop support for this database that ignores basic SQL standards, but I guess that will not be accepted. closing, sorry
        Hide
        Petr Škoda added a comment -

        Please note that Oracle limit is 4000 bytes which translates to the magic number 1333 unicode chars.

        Show
        Petr Škoda added a comment - Please note that Oracle limit is 4000 bytes which translates to the magic number 1333 unicode chars.
        Hide
        Fred Woolard added a comment -

        Understood. Apologies. Thanks for the info. Sorry, I keep forgetting to take Unicode into account. Shoulda known.

        However, the 11g instance I'm running will allow a column nvarchar2(2000), and I can insert a 2000 unicode string into it--there's the 4000 byte limit. But I see now, Unicode may have three bytes per char, not just two.

        Show
        Fred Woolard added a comment - Understood. Apologies. Thanks for the info. Sorry, I keep forgetting to take Unicode into account. Shoulda known. However, the 11g instance I'm running will allow a column nvarchar2(2000), and I can insert a 2000 unicode string into it--there's the 4000 byte limit. But I see now, Unicode may have three bytes per char, not just two.
        Hide
        Petr Škoda added a comment -

        The actual length in Oracle depends on how you define those char fields - in one way you can have up to 4000 or less depending on how many unicode chars are actually used in record, the other way works with the worst case scenario. I was evaluating this together with Eloy and our conclusion (backed by unittests) was that the 1333 is the only safe limit.

        Show
        Petr Škoda added a comment - The actual length in Oracle depends on how you define those char fields - in one way you can have up to 4000 or less depending on how many unicode chars are actually used in record, the other way works with the worst case scenario. I was evaluating this together with Eloy and our conclusion (backed by unittests) was that the 1333 is the only safe limit.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: