Skip to content

Simpletest Tests Failing with Postgresql Database #58

@ghost

Description

As of pressflow-6-72361f3 master of 13/12/2012, SimpleTest tests fail when using Posgresql database (8.4) because of a difference between Mysql and Postgres in the way they handle the data type Serial. The following patch to system.install resolves the issue and fixes all the tests.

diff -r -u /tmp/pressflow-6-72361f3/modules/system/system.install ./modules/system/system.install
--- /tmp/pressflow-6-72361f3/modules/system/system.install      2012-05-02 23:59:43.000000000 +0000
+++ ./modules/system/system.install     2012-12-13 05:13:33.000000000 +0000
@@ -379,13 +379,13 @@
   // uid 2 which is not what we want. So we insert the first user here, the
   // anonymous user. uid is 1 here for now, but very soon it will be changed
   // to 0.
-  db_query("INSERT INTO {users} (uid, name, mail) VALUES(%d, '%s', '%s')", 1, '', '');
+  db_query("INSERT INTO {users} (name, mail) VALUES('%s', '%s')", '', '');
 
   // We need some placeholders here as name and mail are uniques and data is
   // presumed to be a serialized array. Install will change uid 1 immediately
   // anyways. So we insert the superuser here, the uid is 2 here for now, but
   // very soon it will be changed to 1.
-  db_query("INSERT INTO {users} (uid, name, mail, created, data) VALUES(%d, '%s', '%s', %d, '%s')", 2, 'placeholder-for-uid-1', 'placeholder-for-uid-1', time(), serialize(array()));
+  db_query("INSERT INTO {users} (name, mail, created, data) VALUES('%s', '%s', %d, '%s')",'placeholder-for-uid-1', 'placeholder-for-uid-1', time(), serialize(array()));
 
   // This sets the above two users uid 0 (anonymous). We avoid an explicit 0
   // otherwise MySQL might insert the next auto_increment value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions