OpenFileGDB: add missing GetIndexCount() in FileGDBTable::CreateIndex #10624
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
It adds calling GetIndexCount() to retrieve all the existing indexes before creating a new index.
What are related issues/pull requests?
Currently, creating a new index using OpenFileGDB drive causes all the existing indexes are lost.
For example, I have a table with two indexes "FDO_OBJECTID" for "OBJECTID" and "IDx" for "ID. Here are the contents of its gdbindexes file.
But after I run
./ogrinfo BASE.gdb -sql "CREATE INDEX DESCRIPTx ON PIPE_h(DESCRIPT)"
, there is only "DESCRIPTx" for "DESCRIPT" in its gdbindexes file.I find it doesn't call GetIndexCount() to retrieve the existing indexes before creating a new index in the FileGDBTable::CreateIndex function. I think it might be the reason. After I add this line, everything works properly now.