Skip to content

Fix KingBase GetTableNames IndexOutOfRangeException#83

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-index-out-of-bounds-error
Draft

Fix KingBase GetTableNames IndexOutOfRangeException#83
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-index-out-of-bounds-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

KingBaseMetaData.GetTableNames() throws Index was outside the bounds of the array because it accesses dr["Name"] while the underlying SQL aliases the column as TableName.

Change

  • KingBase.csGetTableNames(): Replace dr["Name"] with dr["TableName"] to match the SQL alias in GetTablesSql
// Before — column "Name" does not exist in result set
var name = $"{dr["Name"]}";

// After — matches the SQL alias: select relname as TableName ...
var name = $"{dr["TableName"]}";

The mismatch caused DbRow.get_Item(string name) to look up a non-existent column, triggering the index-out-of-bounds error as soon as DAL.TableNames was accessed on a KingBase connection (including when using time-sharded tables).

…nstead of "TableName"

Agent-Logs-Url: https://github.com/NewLifeX/NewLife.XCode/sessions/54f46dfa-b600-477c-a20e-59dbf7cddd20

Co-authored-by: nygula <13066114+nygula@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix index out of bounds error in KingBaseMetaData Fix KingBase GetTableNames IndexOutOfRangeException Apr 30, 2026
Copilot AI requested a review from nygula April 30, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

金仓数据库分表报错Index was outside the bounds of the array.

2 participants