Skip to content

Fix SHOW COLUMNS and SHOW INDEX to resolve qualified table names - #2201

Merged
mathiasrw merged 5 commits into
developfrom
copilot/fix-qualified-table-name-resolution
Nov 20, 2025
Merged

mathiasrw merged 5 commits into
developfrom
copilot/fix-qualified-table-name-resolution

Conversation

Copilot AI commented Nov 19, 2025 •

Copy link
Copy Markdown
Contributor

SHOW COLUMNS and SHOW INDEX commands fail when using qualified table names (e.g., database.table), returning empty arrays instead of metadata. Works with unqualified names using USE context.

Changes

src/78show.js

  • Updated database resolution in ShowColumns.prototype.execute() and ShowIndex.prototype.execute() to check this.table.databaseid before falling back to this.databaseid or default databaseid
  • Parser already supports qualified names via Table rule, but execution code only checked legacy FROM table FROM database syntax

test/test2200.js

  • Added test coverage for qualified table name resolution across both commands
  • Uses before() and after() hooks for setup and cleanup
  • Follows repository conventions with testId variable naming

Example

-- Now works
SHOW COLUMNS FROM mydb.users;
SHOW INDEX FROM mydb.users;

-- Cross-database queries
USE otherdb;
SHOW COLUMNS FROM mydb.users;  -- Returns correct columns

[!WARNING]

Original prompt

This section details on the original issue you should resolve

<filter_complete></filter_complete>

<issue_title>SHOW COLUMNS and SHOW INDEX don't resolve qualified table names.</issue_title>
<issue_description> SHOW COLUMNS and SHOW INDEX don't resolve qualified table names.

in test613.js i tried to use qualitfied table names, but it returns empty array [] instead of column/index metadata.

Works with unqualified names + USE context, fails with qualified names.

Root cause: Metadata commands don't parse qualified names correctly.
Needs parser/executor updates similar to how SELECT handles qualified names.

</issue_description>

<agent_instructions>Start by making a test2200.js test file that demonstrates the behavour.

Then change the src files to make it work. I expect that you will have to edit the grammar/parser. Please aims for small precise changes to the alasqlparser.jison file and after do yarn jison && yarn test to confirm.

Always run yarn format-all before making a commit. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

Original prompt

This section details on the original issue you should resolve

<issue_title>SHOW COLUMNS and SHOW INDEX don't resolve qualified table names.</issue_title>
<issue_description> SHOW COLUMNS and SHOW INDEX don't resolve qualified table names.

in test613.js i tried to use qualitfied table names, but it returns empty array [] instead of column/index metadata.

Works with unqualified names + USE context, fails with qualified names.

Root cause: Metadata commands don't parse qualified names correctly.
Needs parser/executor updates similar to how SELECT handles qualified names.

</issue_description>

<agent_instructions>Start by making a test2200.js test file that demonstrates the behavour.

Then change the src files to make it work. I expect that you will have to edit the grammar/parser. Please aims for small precise changes to the alasqlparser.jison file and after do yarn jison && yarn test to confirm.

Always run yarn format-all before making a commit. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix qualified table name resolution in SHOW COLUMNS and SHOW INDEX Fix SHOW COLUMNS and SHOW INDEX to resolve qualified table names Nov 19, 2025
Copilot AI requested a review from mathiasrw November 19, 2025 22:46
Comment thread test/test2200.js Resolved
Comment thread test/test2200.js Resolved
Comment thread test/test2200.js Resolved
@mathiasrw

Copy link
Copy Markdown
Member

@copilot Please see the comments.

Copilot AI commented Nov 19, 2025

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • upload.wikimedia.org
    • Triggering command: /usr/local/bin/node node_modules/mocha/bin/mocha.js ./test --reporter dot --bail test/test2200.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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.

SHOW COLUMNS and SHOW INDEX don't resolve qualified table names.

2 participants