clockworklabs / clockworklabs/SpacetimeDB

Consider whether to allow unique constraints on the empty set of columns

Open
#2,080 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

In database dependency theory, it is legal to have a unique constraint (a kind of functional dependency) on the empty set of columns.

This is equivalent to having a unique constraint on a column of type (). A table can store at most one value of type (), so a table with such a constraint can store at most one column.

This is actually a very useful feature: it lets you have "global state" tables with only one row. But this could be considered an antipattern. We should decide whether or not to support it.

If we do want to support it, this may require some extra work. Our unique constraints are implemented with indexes, and I'm not sure if we support indexing on no columns. But this would be a backwards-compatible change.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how unique constraints are represented and implemented through indexes, then check whether zero-column indexes are currently supported. The issue is complete only after the project decides whether empty-column uniqueness is supported and, if so, defines its behavior and validation coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.