Skip to content

Use dbprecision in the RECORDSET descriptor of a named column to close #3195 - #3205

Open
suraj2kumar22020-png wants to merge 1 commit into
AlaSQL:mainfrom
suraj2kumar22020-png:fix-3195-recordset-dbprecision
Open

suraj2kumar22020-png wants to merge 1 commit into
AlaSQL:mainfrom
suraj2kumar22020-png:fix-3195-recordset-dbprecision

Conversation

@suraj2kumar22020-png

Copy link
Copy Markdown

Fixes #3195

The bug

The two RECORDSET forms returned column descriptors with different keys:

alasql('CREATE TABLE A (a INT)');
alasql('SELECT RECORDSET a FROM A').columns;
// [{columnid: 'a', dbtypeid: 'INT', dbsize: undefined, dbpecision: undefined, dbenum: undefined}]

alasql('SELECT RECORDSET * FROM A').columns;
// the same, but with dbprecision

The named-column path in src/select/columns.js built the descriptor with the misspelled key dbpecision, while the star path used dbprecision.

The fix

One-word change in src/select/columns.js: the named-column RECORDSET descriptor now sets dbprecision: tcol.dbprecision, so both forms return identical descriptor keys. (The remaining dbpecision strings in that file are inside commented-out lines and were left untouched.)

Test

Added test/test3195.js (named after the issue, per CONTRIBUTING), asserting that:

  • SELECT RECORDSET a FROM one and SELECT RECORDSET * FROM one return identical column descriptors
  • the descriptor keys are exactly columnid, dbtypeid, dbsize, dbprecision, dbenum

Results

  • New test before the fix: 0 pass / 2 fail (diff shows dbpecision vs dbprecision); after the fix: 2 pass / 0 fail
  • Full suite (bun test over test/test[0-9]*.js and test/test-*.js): 3064 pass, 211 skip, 0 fail across 726 files
  • test-parser passes, and the changed files are prettier-clean

…AlaSQL#3195

The named-column path in src/select/columns.js built the RECORDSET column
descriptor with the misspelled key `dbpecision`, while the star path used
`dbprecision`, so `SELECT RECORDSET a FROM A` and `SELECT RECORDSET * FROM A`
returned descriptors with different keys.

Adds test/test3195.js asserting both forms return identical descriptors
with the `dbprecision` key.
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.

RECORDSET columns have a property dbpecision instead of dbprecision

1 participant