https://bugzilla.wikimedia.org/show_bug.cgi?id=37601

--- Comment #2 from Tim Landscheidt <t...@tim-landscheidt.de> 2012-09-19 
21:54:41 UTC ---
Created attachment 11128
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=11128
Patch for table creation in test case.

The attached patch solves the table creation bug (although the BLOB data type
needs more thought), but the actual test then fails with:

| There was 1 error:

| 1) TestORMRowTest::testSave with data set #0 (array('Foobar', 42, 9000.1,
true, array(13, 11, 7, 5, 3, 2), stdClass), true)
| DBQueryError: A database error has occurred.  Did you forget to run
maintenance/update.php after upgrading?  See:
https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
| Query: INSERT INTO "unittest_orm_test"
(test_id,test_name,test_age,test_height,test_awesome,test_stuff,test_moarstuff)
VALUES
(NULL,'Foobar','42','9000.1',1,'a:6:{i:0;i:13;i:1;i:11;i:2;i:7;i:3;i:5;i:4;i:3;i:5;i:2;}','O:8:"stdClass":3:{s:3:"foo";s:3:"bar";s:3:"bar";a:2:{i:0;i:4;i:1;i:2;}s:3:"baz";b:1;}')
| Function: ORMRow::insert
| Error: 23502 FEHLER:  NULL-Wert in Spalte »test_id« verletzt
Not-Null-Constraint

This is due to explicitly passing NULL as the value for the ID column which in
MySQL means "use next value", but in PostgreSQL means "use NULL".  It can be
worked around by passing the keyword "DEFAULT" (without quotes) as the value,
e. g. "INSERT INTO t (c) VALUES (DEFAULT);".

Jeroen, what do you think is the best approach to support PostgreSQL here? 
From a glance at the code, I would probably exclude ID columns in
ORMRow::getWriteValues() when their value is null.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to