Skip to content

fix: column autocomplete not working against SYSTEM_TABLE_NAME#550

Merged
SanjulaGanepola merged 2 commits into
mainfrom
fix/421-system-table-name-autocomplete
Jun 12, 2026
Merged

fix: column autocomplete not working against SYSTEM_TABLE_NAME#550
SanjulaGanepola merged 2 commits into
mainfrom
fix/421-system-table-name-autocomplete

Conversation

@forstie

@forstie forstie commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Description

Column autocomplete failed to suggest columns when a table was referenced using its system name (short ≤10-char DDS name) instead of its long SQL name.

For example:

  • FROM QSYS2.AUTHORITY_COLLECTION — worked (long SQL name)
  • FROM QSYS2.AUTH_COL — returned no columns (system name)

Root Cause

Table.getItems() in src/database/table.ts queries QSYS2.SYSCOLUMNS2 with:

AND column.TABLE_NAME = ?

This only matches the long SQL name. When the user types the short system name, the query returns no rows and autocomplete shows nothing.

Fix

Extended the WHERE predicate to match either name:

AND (column.TABLE_NAME = ? OR column.SYSTEM_TABLE_NAME = ?)

The parameter array is updated accordingly to pass the table name twice.

Related Issue

Closes #421

Testing

  • Open a SQL file and write a query referencing a system table by its short name, e.g. SELECT * FROM QSYS2.AUTH_COL
  • Trigger column autocomplete — columns should now appear
  • Verify that using the long name still works as before

When a user references a table by its system (short) name in SQL,
e.g. FROM QSYS2.AUTH_COL instead of FROM QSYS2.AUTHORITY_COLLECTION,
the column lookup in Table.getItems() failed to return any columns
because the WHERE clause only matched TABLE_NAME.

Extend the WHERE predicate to also match SYSTEM_TABLE_NAME so both
the long SQL name and the short system name resolve to column metadata.
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

👋 A new build is available for this PR based on e559634.

@forstie forstie requested a review from SanjulaGanepola June 12, 2026 00:57
@forstie forstie self-assigned this Jun 12, 2026
@forstie forstie requested a review from worksofliam June 12, 2026 00:58

@SanjulaGanepola SanjulaGanepola left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test and works as expected!

@SanjulaGanepola SanjulaGanepola merged commit 59a89fc into main Jun 12, 2026
1 check passed
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.

Column autocomplete not working against SYSTEM_TABLE_NAME

2 participants