Skip to content

An apostrophe inside an OQL -- comment produces false MDL030 'no as alias' errors #1175

Description

@marclehane-creator

Version: mxcli 0.23.0 (Windows), Mendix 11.12.1

What happens

An apostrophe inside an OQL -- comment makes the view-entity column checker mis-split the SELECT list,
producing false MDL030 select column N has no as alias errors against the comment text itself.

Repro

mxcli check apos.mdl, no project needed. A comment without an apostrophe is fine:

create view entity MyFirstModule.SaleStats (
  CustomerName: String(200),
  Total: Integer
) as (
  SELECT
    s.CustomerName as CustomerName,
    -- how many orders this customer placed
    SUM(s.Amount) as Total
  FROM MyFirstModule.Sale as s
  GROUP BY s.CustomerName
);

✓ Syntax OK (1 statements) / Check passed!

Change only the comment so it contains an apostrophe:

    -- the customer's running total, summed here rather than on the page

✗ select column 2 has no as alias: '-- the customer's running total'  [MDL030]
✗ select column 3 has no as alias: 'summed here rather than on the page  [MDL030]

Two things go wrong at once: the comment is counted as a select column at all, and it is then split on
its internal comma into two phantom columns.

Impact

Comments are the normal way to document a non-obvious view, and prose comments contain apostrophes
constantly. On a real 31-column view with eight documented columns this produced 12 errors, every one
of them quoting a fragment of a comment, none of them a real defect — mx check reported 0 errors on the
same model.

Because exec refuses to run when the check fails, the only routes offered are --no-check (the wrong
habit to build on a shared model) or deleting a colleague's documentation to satisfy the parser. In
practice it means a documented view entity cannot be round-tripped at all.

Expected

Strip -- to end-of-line before splitting the SELECT list into columns.

Activity

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions