Performing a blind INSERT of a new system preference causes the webinstaller to complain loudly. If the user happens to have DEBUG set, updatedatabase.pl bails on the error. In any case, this is generally bad behavior, and should be fixed.
It would also clear up those annoying "this table already exists" errors for devs (when their database already has the table due to testing or whatever). I approve.
Is this bug still valid, and if so should it still be assigned? This sounds like something that might be considered as a coding guideline rather than something to be patched, or was it planned to retroactively fix updatedatabase.pl?
(In reply to Owen Leonard from comment #2) > Is this bug still valid, and if so should it still be assigned? AFAIK it manifests in upgrades from older versions. Not sure if it shows up when upgrading from more recent versions. > > This sounds like something that might be considered as a coding guideline > rather than something to be patched, or was it planned to retroactively fix > updatedatabase.pl? It was a hope to code up a routine to be called before each INSERT to verify existence. A coding guidline would be helpful as well. Setting it back to NEW since I'm not in the position to fix it atm.
The good practice would be to have an "insert ignore into" statement. But actually you are right, we missed a lot of "insert into" without any check. QAers should keep a closed eye on this.
Sounds like we can close this report?
(In reply to M. de Rooy from comment #5) > Sounds like we can close this report? Had the problem been addressed in a sustainable way? I'm not sure it has.
It should be added to the coding guidelines and catched by QAers for new patches.
(In reply to Jonathan Druart from comment #7) > It should be added to the coding guidelines and catched by QAers for new > patches. I'd like to see it added and a link posted here when the bug is marked resolved for continuity's sake. I'm working on my phone or I'd do it.
Added on http://wiki.koha-community.org/wiki/System_Preferences#Adding_a_new_system_preference and http://wiki.koha-community.org/wiki/Database_updates#updatedatabase.pl
+ http://lists.koha-community.org/pipermail/koha-devel/2015-April/041310.html