From 640d45b89a6d12190f0248b0399181ff06685f62 Mon Sep 17 00:00:00 2001 From: Justin Talbot Date: Thu, 29 Oct 2026 13:51:22 -0700 Subject: [PATCH 1/2] docs(core-spec): Reserve AGG() in Ossie SQL Reserve the function name AGG for measure evaluation, as defined by the Relational Query Interface, and add a compatibility note for older expressions that call a different function named AGG. State that function names should be case insensitive, like regular identifiers. Where model declarations may use AGG is left to a future version. Co-authored-by: Isaac --- core-spec/expression_language.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core-spec/expression_language.md b/core-spec/expression_language.md index dd8f121f2..197b45659 100644 --- a/core-spec/expression_language.md +++ b/core-spec/expression_language.md @@ -87,6 +87,8 @@ All identifiers MUST be valid names and follow ANSI SQL naming, with the size li Regular identifiers (unquoted) should be case insensitive. For example, an identifier id is regular, so it would match with Id or iD. Comparing quoted and non-quoted identifiers is DB specific, so for best portability it is best to use simple identifiers. +Function names should also be case insensitive. For example, `SUM`, `sum`, and `Sum` name the same function. Function names and identifiers are separate namespaces, so a field, metric, or column may have the same name as a function. + The quote character for the Ossie dialect will follow ANSI SQL and support the double quote character (“). This means that if an expression is in a field expression or as an identifier in the YAML, this will be the expected quoting. However, there are some databases that use other escape characters. Working with these have the option of either creating expressions using their dialect or having the Ossie document written in the Ossie dialect, but then queried in the local dialect. #### Comparison Table @@ -278,6 +280,14 @@ COUNT(DISTINCT customer_id) FILTER (WHERE status = 'completed') --> COUNT(DISTI A non-matching row contributes `NULL`, which these functions ignore. An `ELSE 0` would count as a real row and would corrupt `AVG`, `MIN`, `MAX`, and `COUNT`. The identity does not hold for an aggregate function that does not ignore `NULL` inputs, such as `ARRAY_AGG`. +### Measure Evaluation: `AGG` (RESERVED) + +Ossie SQL reserves the function name `AGG` for evaluating a measure: a column that holds an aggregate calculation instead of a value for each row. The [Relational Query Interface](relational_semantics.md) defines measures (Section 4) and `AGG` (Section 6), including its valid arguments. An implementation MUST NOT give `AGG` any other meaning, and a dialect extension MUST NOT define a function of that name. Because function names should be case insensitive, the reservation covers every capitalization, such as `agg` and `Agg`. + +This version reserves the name only. A future version will define where model declarations may use `AGG`. + +**Compatibility.** Earlier versions of this specification did not reserve `AGG`, so an older `OSSIE_SQL_2026` expression might call a different function by that name. To update it, rename that function or write the expression in a vendor dialect. Fields, metrics, and columns can still be named `agg`. + ### Decomposability Reference For multi-stage aggregation (see [Ossie Analytical Context Extension](https://docs.google.com/document/d/1MKNySGmEv_C6CzBZ7um9Ym3_mMvmOolpDuwPvRzQ1bo/edit?usp=sharing)): @@ -853,6 +863,7 @@ Implementations MAY support additional functions through dialect extensions. The | Version | Date | Changes | |:----------|:-----------| :---- | | 0.2.0.dev | 2026-07-15 | Initial draft | +| 0.2.0.dev | 2026-10-29 | State that function names are case insensitive. Reserve `AGG` for measure evaluation; expressions that call another function named `AGG` must rename it or move to a vendor dialect | --- From 5a953a59ecac3b4f61287382a62a37dc0418f2bf Mon Sep 17 00:00:00 2001 From: Justin Talbot Date: Mon, 2 Nov 2026 09:16:48 -0800 Subject: [PATCH 2/2] docs(core-spec): Address review feedback on the AGG() reservation Limit the reservation to OSSIE_SQL_2026 expressions, since vendor dialects are opaque, and state that OSSIE_SQL_2026 expressions must not call AGG until a future version defines where it may be used. List it under Not Supported in Expressions. Drop the general claim that function names and identifiers are separate namespaces, which has exceptions this change does not need to define. The compatibility note keeps the narrower claim that a field, metric, or column may still be named agg. Co-authored-by: Isaac --- core-spec/expression_language.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core-spec/expression_language.md b/core-spec/expression_language.md index 197b45659..52750a418 100644 --- a/core-spec/expression_language.md +++ b/core-spec/expression_language.md @@ -87,7 +87,7 @@ All identifiers MUST be valid names and follow ANSI SQL naming, with the size li Regular identifiers (unquoted) should be case insensitive. For example, an identifier id is regular, so it would match with Id or iD. Comparing quoted and non-quoted identifiers is DB specific, so for best portability it is best to use simple identifiers. -Function names should also be case insensitive. For example, `SUM`, `sum`, and `Sum` name the same function. Function names and identifiers are separate namespaces, so a field, metric, or column may have the same name as a function. +Function names should also be case insensitive. For example, `SUM`, `sum`, and `Sum` name the same function. The quote character for the Ossie dialect will follow ANSI SQL and support the double quote character (“). This means that if an expression is in a field expression or as an identifier in the YAML, this will be the expected quoting. However, there are some databases that use other escape characters. Working with these have the option of either creating expressions using their dialect or having the Ossie document written in the Ossie dialect, but then queried in the local dialect. @@ -155,6 +155,7 @@ Ossie expressions support the following SQL constructs within any expression: | `UNION` / `INTERSECT` / `EXCEPT` | Not applicable to expressions | | DDL statements | Out of scope | | DML statements | Out of scope | +| `AGG(...)` | Reserved for a future version. See [Measure Evaluation: `AGG`](#measure-evaluation-agg-reserved). | ### Operator Precedence @@ -282,11 +283,11 @@ A non-matching row contributes `NULL`, which these functions ignore. An `ELSE 0` ### Measure Evaluation: `AGG` (RESERVED) -Ossie SQL reserves the function name `AGG` for evaluating a measure: a column that holds an aggregate calculation instead of a value for each row. The [Relational Query Interface](relational_semantics.md) defines measures (Section 4) and `AGG` (Section 6), including its valid arguments. An implementation MUST NOT give `AGG` any other meaning, and a dialect extension MUST NOT define a function of that name. Because function names should be case insensitive, the reservation covers every capitalization, such as `agg` and `Agg`. +Ossie SQL reserves the function name `AGG` for evaluating a measure: a column that holds an aggregate calculation instead of a value for each row. The [Relational Query Interface](relational_semantics.md) defines measures (Section 4) and `AGG` (Section 6), including its valid arguments. In `OSSIE_SQL_2026` expressions, an implementation MUST NOT give `AGG` any other meaning. Expressions in other dialects are not affected. Because function names should be case insensitive, the reservation covers every capitalization, such as `agg` and `Agg`. -This version reserves the name only. A future version will define where model declarations may use `AGG`. +This version reserves the name only. `OSSIE_SQL_2026` expressions MUST NOT call `AGG` until a future version defines where model declarations may use it. -**Compatibility.** Earlier versions of this specification did not reserve `AGG`, so an older `OSSIE_SQL_2026` expression might call a different function by that name. To update it, rename that function or write the expression in a vendor dialect. Fields, metrics, and columns can still be named `agg`. +**Compatibility.** Earlier versions of this specification did not reserve `AGG`, so an older `OSSIE_SQL_2026` expression might call a different function by that name. To update it, rename that function or write the expression in a vendor dialect. Reserving `AGG` as a function name does not prevent a field, metric, or column from being named `agg`. ### Decomposability Reference