Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36920 SQLite support for 3.9+
  3. MDL-36930

SQLite unit test failure: duplicate keys when adding Foreign Keys

XMLWordPrintable

    • MOODLE_23_STABLE

      The following two tests fail with SQLite giving the same error message:

      testAddForeignUniqueKey()
      testAddForeignKey

      The error is:

      coding_exception: Coding error detected, it must be fixed by a programmer: Duplicate key course specified in table test_table1

      But it seems like the error is legitimate, when the test_table1 is created it has a key of that name added (on line 93 of ddl_test.php).

      Changing the name of the key that is to be added makes the test pass.

      So, is this test supposed to be testing what happens when adding a second key with the same name? If so the name of the test isn't very clear about that and the test doesn't actually test any expected values, it just assumes that it has succeeded if no errors get thrown but doesn't specifically test that an expected exception gets thrown or test for an error code.

      If it isn't intentionally testing adding the same key twice, and it's simply testing adding foreign keys to a table then why is it adding a key that already exists? And why don't any of the other databases complain about it?

            dobedobedoh Andrew Lyons
            bawjaws David Scotson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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