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

XMLDB cannot create 32-bit SERIAL fields in Postgres

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.8.1, 1.9
    • 1.8, 1.8.1, 1.9
    • Database SQL/XMLDB
    • None
    • PostgreSQL
    • MOODLE_18_STABLE, MOODLE_19_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

      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).

            stronk7 Eloy Lafuente (stronk7)
            quen Sam Marshall
            Nobody Nobody
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.