Files
Shubham Mishra de2b65fb8d SQL alias (#4304)
# Description of Changes


- [x] : Store "accessor"s names in ModuleDef (for tables, columns, and
indexes for now) and pass them to TableSchema as aliases.

- [x] Create accessor system tables for each of them:
`st_table_accessor`,`st_column_accessor`, `st_index_accessor`

- [x] Update the SQL parsing logic to also consider alias names.



Alias name stored will be same as actual names until we merge
https://github.com/clockworklabs/SpacetimeDB/pull/4263
# API and ABI breaking changes
NA

# Expected complexity level and risk

3

This patch updates SQL name resolution which isn't a very complex change
since table and column name resolution are each handled by their own
helper method.

It also adds new system tables which need to be handle correctly during
restore/replay. We do have regression tests for this that should catch
any incorrect handling or missing steps.

I would say the main risk is that we don't populate cached table and
column schemas with the alias/accessor name. Regression tests have been
added to catch this, but there are edge cases around migrations and
replay that currently aren't covered.

# Testing
 
Added SQL smoketests that use canonical/accessor table/column names.
They currently fail because we're currently using the accessor name for
both. They should pass once this is updated.

---------

Co-authored-by: rekhoff <r.ekhoff@clockworklabs.io>
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
Co-authored-by: clockwork-labs-bot <bot@clockworklabs.com>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2026-02-17 10:15:15 +00:00

54 lines
1.7 KiB
TOML

[package]
name = "spacetimedb-datastore"
version.workspace = true
edition.workspace = true
license-file = "LICENSE"
description = "The datastore library for SpacetimeDB"
rust-version.workspace = true
[dependencies]
spacetimedb-data-structures.workspace = true
spacetimedb-lib = { workspace = true, features = ["serde", "metrics_impls"] }
spacetimedb-commitlog.workspace = true
spacetimedb-durability.workspace = true
spacetimedb-metrics.workspace = true
spacetimedb-primitives.workspace = true
spacetimedb-paths.workspace = true
spacetimedb-sats = { workspace = true, features = ["serde"] }
spacetimedb-schema.workspace = true
spacetimedb-table.workspace = true
spacetimedb-snapshot.workspace = true
spacetimedb-execution.workspace = true
anyhow = { workspace = true, features = ["backtrace"] }
bytes.workspace = true
derive_more.workspace = true
enum-as-inner.workspace = true
enum-map.workspace = true
itertools.workspace = true
lazy_static.workspace = true
log.workspace = true
once_cell.workspace = true
parking_lot.workspace = true
prometheus.workspace = true
smallvec.workspace = true
strum.workspace = true
thiserror.workspace = true
thin-vec.workspace = true
[features]
# Print a warning when doing an unindexed `iter_by_col_range` on a large table.
unindexed_iter_by_col_range_warn = []
default = ["unindexed_iter_by_col_range_warn"]
# Enable test helpers and utils
test = ["spacetimedb-commitlog/test", "spacetimedb-schema/test"]
[dev-dependencies]
spacetimedb-lib = { path = "../lib", features = ["proptest"] }
spacetimedb-sats = { path = "../sats", features = ["proptest"] }
spacetimedb-commitlog = { path = "../commitlog", features = ["test"] }
# Also as dev-dependencies for use in _this_ crate's tests.
proptest.workspace = true
pretty_assertions.workspace = true