[feladat @ 107]
Fixing ticket:17 (zone listing and count in user management screen incomplete).
README.sequence-Additionaldocumentationonmanualinserts(usingpoweradminalongwithotherinterfacestothepowerdnsdatabase).Removalof"sequence updater"-----------------------------------------------------------------------Uptopoweradminversion1.2.7-patched,thecodeincludedthesocalled"sequence updater".Itwaswrittentosynchronizepoweradminwiththedatabaseaftermanualinsertsofzonesandrecords.Thishappensifyouinsertnewzonesorrecordsbyhand,orhaveotherinterfacesthanpoweradmintalkingtothedatabaseaswell.The1.2.7-patchedversionofpoweradminwasusingthePEAR::DBmodule,usingit's nextID() function. It tells the application what will bethe next ID for insertion. However, mysql has "auto_increment" andpgsqlhas"serial".BothallowtodoinsertwithID's created on therun, without the need of seperate sequence numbers.In order to get rid of the incidental errors and the need to hit the"synchronize database" from time to time, the "sequence updater" hasbeen removed and the code has been updated to use the "auto_increment"and "serial" functionality. As long as you do manual inserts thecorrect way, this will not cause any problems.Insert new records and zones the correct way (using other tools)-----------------------------------------------------------------------According to the documentation of powerdns (2.9.20), the id column ofthe tables domains and records in a mysql setup are created using the"auto_increment" option and in a pgsql setup using the "serial"option. [1] This will allow for auto increments of the id field, as long as no onedoesamanualinsert,specifyingtheid.So,let's say we have createda table, one in mysql, one in pgsql: CREATE TABLE xmpl_tbl (id INT auto_increment, text TEXT); CREATE TABLE xmpl_tbl (id SERIAL PRIMARY KEY, text TEXT);This insert will work in pgsql only:INSERTINTOxmpl_tblVALUES(DEFAULT,'First insert test");These inserts will work in mysql only:INSERTINTOxmpl_tblVALUES(NULL,'Third insert test"); INSERTINTOxmpl_tblVALUES('','Fourth insert test"); Thiswillworkinbothmysqlandpgsql(aslongasiddidn't existalready), but it will break "auto increment" feature in pgsql [2] (canbe fixed using setval() functionality in pgsql):INSERTINTOxmpl_tblVALUES(42,'Fifth insert test");This will work in both mysql and pgsql:INSERTINTOxmpl_tbl(text)VALUES('Second insert test");So, in other words: if you want to insert records and zones into thepowerdns database using other tools and interfaces than poweradmin,you should make sure you are using the correct syntax.Limitations-----------------------------------------------------------------------Removing the "sequence updater" removes the possibilty to use thepoweradmin code against other databases than mysql and pgsql (or atleast, it is untested).More information-----------------------------------------------------------------------More information can be found here: - PowerDNS manual, section backends in detail <http://downloads.powerdns.com/documentation/html/generic-mypgsql-backends.html> - Postgresql documentation, section Operational Questions <http://www.postgresql.org/files/documentation/books/aw_pgsql/node196.html#SECTION0029916000000000000000> - pgsql-bugs mailinglist archive <http://archives.postgresql.org/pgsql-bugs/2004-11/msg00340.php> <http://archives.postgresql.org/pgsql-bugs/2004-11/msg00344.php>