Last modified: 2014-08-06 16:53:00 UTC
While upgrading a postgresql backed instance of SMW 1.5.something, to 1.6.1 I got this error: ... creating field smw_subobject ... Warning: pg_query(): Query failed: ERROR: column "smw_subobject" contains null values in /home/cffc/webapps/htdocs/w/includes/db/DatabasePostgres.php on line 237 A database query syntax error has occurred. The last attempted database query was: "ALTER TABLE smw_ids ADD "smw_subobject" TEXT NOT NULL" from within function "SMWSQLHelpers::updatePostgresField". Database returned error "1: ERROR: column "smw_subobject" contains null values" Obviously we can't just go around adding NOT NULL fields without setting a default value. This might be a postgresql code specific issue, or even a field specific issue — if php gave me a traceback, maybe I'd go looking — but it might be worth checking over all the database upgrade code to catch the general case.
Obviously deleting all the tables, re-adding them and running SMW_refreshData.php fixes the problem (for small data sets), except that this triggers #31153 for postgresql installation.
SMW 1.6.1 is no longer in support and it is likely that the issue has already been solved. If the issue still persists on a supported [0] platform, please feel free to open a new issue at [1]. [0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/COMPATIBILITY.md [1] https://github.com/SemanticMediaWiki/SemanticMediaWiki