Skip to content

Enable test341: SQL-99 COLUMN keyword support#2368

Merged
mathiasrw merged 2 commits intodevelopfrom
copilot/add-column-keyword-support
Dec 15, 2025
Merged

Enable test341: SQL-99 COLUMN keyword support#2368
mathiasrw merged 2 commits intodevelopfrom
copilot/add-column-keyword-support

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

Description

The SQL-99 standard SELECT COLUMN keyword was already implemented in AlaSQL but test341 was skipped. This PR enables the tests to verify the functionality.

Changes

  • test/test341.js: Enabled 4 tests by removing .skip():
    • Test 1: Database setup
    • Test 2: Table creation with test data
    • Test 3: SELECT COLUMN persons.name FROM persons (primary test case)
    • Test 99: Database cleanup

Implementation

The COLUMN modifier extracts a single column and returns an array of values instead of objects:

// Standard SELECT: array of objects
alasql('SELECT name FROM persons')
// → [{"name":"Andrey"},{"name":"Valery"},{"name":"Michael"}]

// SELECT COLUMN: array of values (SQL-99)
alasql('SELECT COLUMN persons.name FROM persons')
// → ["Andrey","Valery","Michael"]

Parser support exists at src/alasqlparser.jison:803-804, execution logic at src/40select.js:599-619.

Test Results

  • 4/4 enabled tests passing
  • Full suite: 2025 passing, 397 pending
  • No regressions
Original prompt

This section details on the original issue you should resolve

<issue_title>SQL Standard Column Selector - COLUMN Keyword Support</issue_title>
<issue_description>Priority: 1 (Critical)
Impact: SQL-99 Compliance
Test File: test/test341.js
Test Location: Line 32
Test Name: "3. SQL Standard way"

Problem Description

The test test341.js line 32 contains a skipped test for the SQL standard COLUMN keyword selector. This test verifies that AlaSQL supports the SQL-99 standard way of selecting single column values using the COLUMN keyword.

Specific Test Case

it.skip('3. SQL Standard way', function (done) {
    var res = alasql('SELECT COLUMN persons.name FROM persons');
    assert.deepEqual(res, ['Andrey', 'Valery', 'Michael']);
    done();
});

Expected Behavior

According to SQL-99 standard, the COLUMN keyword should be used to select a single column from a table, returning an array of values rather than an array of objects. This is different from the standard SELECT which returns objects.

Current Status

  • Test Status: Skipped (it.skip)
  • Error: Unknown (test not executed)
  • Root Cause: COLUMN keyword not implemented in AlaSQL parser

Steps to Reproduce

  1. Navigate to test/test341.js
  2. Change it.skip('3. SQL Standard way' to it('3. SQL Standard way'
  3. Run the test with: yarn test-only -- test/test341.js
  4. Test will fail with parse error or unexpected results

Expected Test Setup

The test expects:

  • A persons table with name column
  • Data: ['Andrey', 'Valery', 'Michael']
  • SELECT COLUMN persons.name FROM persons should return ['Andrey', 'Valery', 'Michael']

Implementation Requirements

  1. Parser Support: Add COLUMN keyword to the SQL parser grammar
  2. Query Execution: Modify query execution to handle COLUMN selector differently
  3. Result Format: Return array of values instead of array of objects
  4. Table Setup: Ensure proper test data is available

SQL-99 Features Involved

  • COLUMN keyword in SELECT statements
  • Single column selection with value array return
  • SQL-99 standard column selector syntax

Dependencies

  • AlaSQL parser (src/alasqlparser.jison)
  • Query execution engine
  • Result formatting logic
  • Test database setup

Acceptance Criteria

  • Test is enabled (remove it.skip)
  • Parser recognizes COLUMN keyword
  • Query execution returns array of values
  • Test data setup works correctly
  • All assertions pass
  • No regression in existing SELECT functionality

Implementation Notes

The COLUMN keyword should:

  • Only work with single column selection
  • Return array of values (not objects)
  • Be SQL-99 compliant
  • Work with qualified column names (table.column)

Parser Changes Needed

In src/alasqlparser.jison, add support for:

select_clause: COLUMN column_expression ...

</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 13, 2025
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Copilot AI changed the title [WIP] Add COLUMN keyword support for SQL standard selector Enable test341: SQL-99 COLUMN keyword support Dec 13, 2025
Copilot AI requested a review from mathiasrw December 13, 2025 14:53
@mathiasrw mathiasrw marked this pull request as ready for review December 15, 2025 02:50
@mathiasrw mathiasrw merged commit c2b51c4 into develop Dec 15, 2025
10 checks 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.

SQL Standard Column Selector - COLUMN Keyword Support

2 participants