Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-9920

XMLDB cannot create 32-bit SERIAL fields in Postgres

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.8.1, 1.9
    • Fix Version/s: 1.8.1, 1.9
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      Even if you specify LENGTH="9", under Postgres SERIAL fields are always created as BIGSERIAL, which seems like a bug to me.

      I know this is fine for ordinary Moodle cases, because LENGTH="10", but sometimes when working on special tables where database efficiency (size) is critical you do actually want 32-bit IDs.

      An issue that probably doesn't affect core code but might be of interest to some plugin developers.

      Anyway I have attached a patch that modifies the xmldb base class generator so that it can use a different word for sequences that are LENGTH="9" or less, and modified postgres generator to use this. It is quite simple and self-explanatory and appears to work although I haven't much tested it. If you're ok with the patch perhaps you could check it in - or comment if you want me to commit it (tell me whether MOODLE_18_STABLE or just HEAD).

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            +1 to implement it (not to be used for Moodle core) after chat with Sam.

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - +1 to implement it (not to be used for Moodle core) after chat with Sam.
            Hide
            quen Sam Marshall added a comment -

            I committed this change to MOODLE_18 and HEAD.

            Agreed that database coding guidelines mean all tables in core Moodle should still specify 10 digits for id field.

            Show
            quen Sam Marshall added a comment - I committed this change to MOODLE_18 and HEAD. Agreed that database coding guidelines mean all tables in core Moodle should still specify 10 digits for id field.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Jun/07