Skip to content

typelayer: table CHECK constraints are not evaluated at ingest #727

Description

@EricAndrechek

Found while moving the type layer to chtypes 1.0 in draft PR #712 (branch chtypes-v2).

Problem. Table CHECK constraints are not evaluated at ingest.

  • WaveHouse builds the CREATE TABLE it gives chtypes from discovery's columns (system.columns), so no CONSTRAINT … CHECK reaches chtypes.
  • A record that violates a table CHECK is accepted, and may be delivered on the stream.
  • The server then refuses it at INSERT (code 469), and the worker parks it.

This was already the case before #712 (main does not evaluate table CHECKs at ingest either), so it is not a regression.

Evidence.

  • Measured by a probe of the chtypes 1.0 artifact during feat(typelayer)!: validate, coerce and filter through chtypes #712: chtypes compiles CONSTRAINT … CHECK clauses, and its CHECK verdicts now match the server's. That covers non-UInt8 results refused with code 1, and x > 0 refused with 469, on exactly the rows the server refuses.
  • Inferred from internal/typelayer/ddl.go, which emits columns only, and internal/discovery (which reads system.columns; system.tables.create_table_query is fetched but not used for this).

Effect. Clients get 202/200 for records that will never be stored. Stream subscribers can see rows that the table refuses.

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions