Hello, just testing your module for use in our system and I get this error.

warning: pg_query(): Query failed: ERROR: syntax error at or near "SET" LINE 1: INSERT INTO cq_user_answer SET answer="i:0;", data="N;", onc... ^ in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO cq_user_answer SET answer="i:0;", data="N;", once_correct=0, tries=1, uid=3, nid=3 in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 203.
warning: pg_query(): Query failed: ERROR: syntax error at or near "SET" LINE 1: INSERT INTO cq_user_answer_log SET answer="i:0;", once_corre... ^ in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO cq_user_answer_log SET answer="i:0;", once_correct=0, tries=1, uid=3, nid=3, unixtime=1302293598 in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 153.

Comments

VeeLin’s picture

Sorry - more details. So I created a question using the demo example code from here: http://wmmrc.wur.nl/Drupal%20Modules/Manual/Examples/choice-single

The question is created OK. When I select the first answer and submit I get the above error.

HylkeVDS’s picture

I guess postgresql doesn't know the INSERT ... SET ... syntax, and I guess you're the first postgresql user :)
I'll release a new version Monday morning using the INSERT ... VALUES... syntax.

HylkeVDS’s picture

Status: Active » Closed (fixed)

It should be fixed in beta6. Please re-open this issue if you find any more postgresql incompatibility issues.

VeeLin’s picture

thanks for looking into this!. Re-installed beta6. and created a questionf rom this example code:
http://wmmrc.wur.nl/Drupal%20Modules/Manual/Examples/choice-single
Question saved properly but when I select the first answer and submit I get:

warning: pg_query(): Query failed: ERROR: column "i:0;" does not exist LINE 5: ("i:0;", "N;", 0, 1, 1, 2) ^ in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO cq_user_answer (answer, data, once_correct, tries, uid, nid) VALUES ("i:0;", "N;", 0, 1, 1, 2) in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 211.
warning: pg_query(): Query failed: ERROR: column "i:0;" does not exist LINE 5: ("i:0;", 0, 1, 1, 2, 1303229157) ^ in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO cq_user_answer_log (answer, once_correct, tries, uid, nid, unixtime) VALUES ("i:0;", 0, 1, 1, 2, 1303229157) in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 157.
VeeLin’s picture

Version: 6.x-2.0-beta5 » 6.x-2.0-beta6
Status: Closed (fixed) » Active

Running the query in postgres I get success with :

INSERT INTO cq_user_answer (answer, data, once_correct, tries, uid, nid) 
VALUES ('i','N','0','1','1','2')
VeeLin’s picture

So after manually filling the table with what I think you wanted as per above comment I get the following errors:

warning: pg_query(): Query failed: ERROR: column "i:0;" does not exist LINE 1: UPDATE cq_user_answer SET answer="i:0;", data="b:0;", once_c... ^ in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: UPDATE cq_user_answer SET answer="i:0;", data="b:0;", once_correct=0, tries=2 WHERE uid=1 AND nid=2 in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 235.
warning: pg_query(): Query failed: ERROR: column "i:0;" does not exist LINE 5: ("i:0;", 0, 2, 1, 2, 1303231200) ^ in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO cq_user_answer_log (answer, once_correct, tries, uid, nid, unixtime) VALUES ("i:0;", 0, 2, 1, 2, 1303231200) in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 157.

And the correct query for the update would be:

UPDATE cq_user_answer SET answer='i:0;', data='b:0;', once_correct=0, tries=2 WHERE uid=1 AND nid=2

It's complaining about the double quotes. Also with the above the value for answer is "i:0;" - not sure what you wanted in there . . .
I hope that helps. it would be fantastic if you got this working with PostgreSQL!

VeeLin’s picture

And one more when re-setting the question:

warning: pg_query(): Query failed: ERROR: syntax error at or near "SET" LINE 1: INSERT INTO cq_user_answer_log SET answer="Reset", once_corr... ^ in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO cq_user_answer_log SET answer="Reset", once_correct=0, tries=0, uid=1, nid=2, unixtime=1303240892 in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 260.
HylkeVDS’s picture

Ah, pg doesn't like " around strings. I'll change those to single quotes.
And I missed an insert.

the i:0; is a php serialised integer 0, so that's correct.
I'll fix it soon.

HylkeVDS’s picture

Assigned: Unassigned » HylkeVDS
Status: Active » Closed (fixed)

I've released beta7, let me know if you find more problems.

VeeLin’s picture

OK,
The bad news is that it's still got some errors. The good news is that they are different then before . . .
So I completely uninstalled the module and re-installed to eliminate any errors due to my manual manipulation of the tables yesterday and then repeated the steps in #4 above. I get:

warning: pg_query(): Query failed: ERROR: null value in column "evalid" violates not-null constraint in /home/sparcsadmin/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: INSERT INTO cq_user_answer_log (answer, once_correct, tries, uid, nid, unixtime) VALUES ('i:0;', 0, 1, 1, 7, 1303313312) in /home/sparcsadmin/drupal6/sites/all/modules/closedquestion/question/CqUserAnswerDefault.class.php on line 157.

You rock!

HylkeVDS’s picture

Version: 6.x-2.0-beta6 » 6.x-2.0-beta7

Ok, Beta8 should fix that one.
Postgresql is a lot stricter than MySQL :)

VeeLin’s picture

I'm not getting any more errors :-)
THANKS !!!