#75 Postgres saving integers

Database (4)

While trying to import some sample questions I noticed that we are trying to send '' as a value for an integer field, and this is something Postgres does not tolerate (no SQL database should).

The fields in question are questionUserLastEdited and line. Naturally, these do not have any values when importing so one would either need to send NULL to the database or for example -1 if it does not mean anything else.

For Postgres users the next problem is just saving a new question. As one cannot save without a line-value and it seems to be blank...


  • Matti Harjula

    Matti Harjula - 2010-12-22

    A duplicate for some reason. I too want to use Postgres! But this bug has another reason than sending bad values, there is a previous statement that fails and does not return an integer that could be sent. It is in the newLine() function. The query that they use for creating a new row works for MySQL but not for Postgres and things go badly because of that. If you want to continue testing change it like this:

    INSERT INTO question_lines() VALUES(); -> INSERT INTO question_lines(modified) VALUES(now());

    That version should work both in MySQL and Postgres

  • Matti Harjula

    Matti Harjula - 2010-12-22

    And before going forward you may want to change this one also:

    In lib/database/StackDBOpaque.php:
    public function storeSession($item, $sessionID, $stateID=0, $userID=0, $progress=0, $timeclose=NULL)
    public function storeSession($item, $sessionID, $stateID=0, $userID=0, $progress=0, $timeclose=-1)

    Otherwise STACK wont be able to communicate with the Moodle modules.

  • Chris Sangwin

    Chris Sangwin - 2011-08-06
    • status: open --> closed