Skip to content

A column named value reads as the VALUE keyword in expressions: WHERE value = 3 finds no rows #2670

Open

Description

@mathiasrw

Since #2203 a table can have a column named value, but in an expression a bare value is still read as the VALUE keyword (the value being checked in a CHECK or domain), not as the column. Queries give wrong results with no error.

Measured on develop (756f5b2), next to SQLite 3.43:

CREATE TABLE t (value INT, b INT);
INSERT INTO t VALUES (1, 2), (3, 4);
Query AlaSQL SQLite
SELECT b, value FROM t [{b: 2, VALUE: {}}, {b: 4, VALUE: {}}] 2, 1 and 4, 3
SELECT b FROM t WHERE value = 3 [] 4
SELECT b FROM t ORDER BY value DESC 2, 4 (not sorted) 4, 2
SELECT MAX(value) AS m FROM t [{}] 3
SELECT value + 1 AS x FROM t 1 2, 4
SELECT value FROM t throws Column does not exist: _ 1, 3

t.value, [value] and UPDATE t SET value = 5 work.

Direction

Outside a CHECK or domain definition, value in an expression is the column. Right after SELECT it stays the SELECT VALUE modifier, as for ROW and MATRIX (#2628). Nobody can rely on {} or undefined here, so this can go into 4.x.

Reported in #1155 (2020). Related: #2202, #2203, #2627, #2628.

Activity

  1. added this to the v4.x Focus milestone on Oct 20, 2026
  2. mathiasrw commented on Oct 20, 2026

    @mathiasrw
    MemberAuthor

    Cause found while reviewing #746: the grammar has Expression: VALUE → yy.DomainValueValue, a stub for domains whose toJS returns the whole row. AlaSQL has no CREATE DOMAIN, and CHECK (VALUE > 0) refuses every row, so removing VALUE from Expression looks like the fix here. Details in the review issue for #746.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions