From: Nirgal V. <con...@ni...> - 2011-02-05 18:56:23
|
Hello MDB folks. I'm trying to have mdb-schema export the indexes. I hit a couple of problems in mdb_read_indices: 1/ When parsing table definition page, we expect index->index_num to be growing from 0 to table->num_real_idxs. This is not allways true. I think you can reproduce the problem by deleting some indexes. This resulted in wrong columns beeing associated with indexes. Include is a patch that will find the index with matching index_num. 2/ When associating the columns with the index, we were assuming the column position in table->columns is the same than col->col_num This is not allways true. I think you can reproduce this by deleting some columns. This resulted in segment violation. The patch include a loop to find the column with the correct col_num. Also, I moved the test about pidx being null and num_real_idxs beeing patched, up in the logic. I still don't really like it, but it's a bit better IMHO. Finally, I updated the HACKING file, and I left some of my debug messages commented out. I suggest you merge the indexes patch, for the github repository. Included is also another patch for mdb-schema to output the index creation section. This is work in progress, and I suggest you don't merge it yet, because it wrongfully assumes you are using postgres backend: It will generate this kind of lines: -- CREATE ANY INDEXES ... CREATE INDEX "tTelecomsDescription" ON "tTelecom" ("sDescription"); CREATE UNIQUE INDEX "tAuthorisationActionsDescription" ON "tAuthorisationAction" ("sDescription"); ALTER TABLE "tGeneralDefinition" ADD CONSTRAINT "tGeneralDefinitionprimarykey" PRIMARY KEY ("iDefinitionGroupID", "iDatabaseID"); Could any one point to me the different index syntaxes for our supported backends? |