4 Commits

Author SHA1 Message Date
Glauber Costa
a2b7f8d846 docs: mention array types in data-types and CREATE TYPE pages
Arrays are part of the custom types system alongside STRUCT and UNION,
but were only documented in the array functions page. Now the data-types
page introduces arrays early (opening paragraph + STRICT types callout)
and the CREATE TYPE page has a dedicated Array Types section with examples.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-07 08:08:02 -05:00
Glauber Costa
0d30ac633b Add STRUCT and UNION composite types for STRICT tables
Adds STRUCT and UNION composite types, defined via CREATE TYPE and
usable as column types in STRICT tables.

- STRUCT stores named, typed fields as a SQLite record blob
- UNION is a tagged union (one-byte tag + variant value)
- New functions: struct_pack, struct_extract, union_value, union_tag,
  union_extract
- Dot notation sugar: col.variant.field desugars to nested extract calls
- Type checking enforces schema on INSERT
- Expression indexes on STRUCT/UNION functions are supported
- Partial index WHERE predicates using custom type functions work
  correctly across INSERT, UPDATE, and UPSERT (uses emit_dml_expr_index_value
  to preserve type context)

Gated behind --experimental-custom-types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-23 18:33:00 -04:00
Glauber Costa
0bc101a6b3 feat: add array column type support with PostgreSQL-style array functions
Adds array column types (e.g. INTEGER[], TEXT[][]) stored as record-format
blobs with zero-copy ValueIterator streaming. Includes ARRAY[] constructor,
subscript access, comparison operators (@>, &&, =, <, etc.), 12 scalar
functions (array_length, array_append, array_cat, etc.), and array_agg
aggregate. Parser extended with ARRAY keyword, bracket subscripts, and
new operator tokens.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 10:19:39 -04:00
Glauber Costa
b3eeabf38d add SQL language reference documentation
Comprehensive SQL reference at docs/sql-reference/ covering all
supported statements, functions, expressions, PRAGMAs, and
extensions. Includes mdBook-based local preview (./preview.sh).

Turso-specific features (CDC, materialized views, custom types,
MVCC, vector search, FTS, encryption) are integrated inline with
callouts. Experimental features link to a dedicated page with
enablement instructions for the CLI and all SDKs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 14:05:32 -06:00