Last modified: 2014-08-06 16:53:00 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33152, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31152 - [postgresql] Database upgrades fail when adding NOT NULL fields
[postgresql] Database upgrades fail when adding NOT NULL fields
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-25 13:16 UTC by John Morton
Modified: 2014-08-06 16:53 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description John Morton 2011-09-25 13:16:19 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.
Comment 1 John Morton 2011-09-25 13:22:49 UTC
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.
Comment 2 MWJames 2014-08-06 16:53:00 UTC
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links