Skip to content

docs: CURRENT_TIMESTAMP is not a valid column DEFAULT — the grammar takes _ingest.timestamp #244

Description

@fupelaqu

Summary

Both documentation repos show CURRENT_TIMESTAMP as a column DEFAULT in a CREATE TABLE. It does not parse. The grammar takes _ingest.timestamp.

Reproduce

CREATE TABLE t (id INT, createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
-- ParserError(')' expected but 'D' found)

CREATE TABLE t (id INT, createdAt TIMESTAMP DEFAULT _ingest.timestamp);
-- OK

Isolated: the failure is specific to CURRENT_TIMESTAMP in the DEFAULT position. KEYWORD DEFAULT 'pending' and VARCHAR DEFAULT 'anonymous' both parse, so DEFAULT itself is fine.

Where

repo file line
SoftClient4ES documentation/sql/materialized_views.md 401
softclient4es-web src/content/docs/sql/materialized-views.mdx 223

Both read createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, inside an otherwise valid CREATE TABLE.

Why these two are the outliers

The grammar accepts value | ingest_id | ingest_timestamp, where ingest_timestamp is the literal _ingest.timestamp (sql/.../parser/type/package.scala:103).

Everywhere else already uses the correct form:

  • documentation/sql/dql_statements.md — 4 occurrences of DEFAULT _ingest.timestamp
  • core/src/main/resources/help/commands/ddl/create_table.json — 4 occurrences, zero CURRENT_TIMESTAMP

So this is two stray lines, not a systemic misunderstanding.

Note CURRENT_TIMESTAMP is valid as an expression (SELECT CURRENT_TIMESTAMP, WHERE … >= DATE_SUB(CURRENT_TIMESTAMP, …)) — those uses are correct and should not be touched. It is only invalid in the DEFAULT position.

Suggested fix

Replace with DEFAULT _ingest.timestamp in both files. Verified: the full materialized-view CREATE TABLE example parses once that single token is changed.

How it was found

Parse-probing every SQL example in the web documentation through Parser.apply (120 statements). Filed rather than fixed inline at the maintainer's request.

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