Skip to content

docs: state varchar/char defaults to '' as a rule, not a preference - #271

Open
dimitri-yatsenko wants to merge 2 commits into
mainfrom
docs/varchar-null-default-rule
Open

docs: state varchar/char defaults to '' as a rule, not a preference#271
dimitri-yatsenko wants to merge 2 commits into
mainfrom
docs/varchar-null-default-rule

Conversation

@dimitri-yatsenko

Copy link
Copy Markdown
Member

`definition-syntax.md` already showed `''` as the preferred string default, but phrased the guidance as "prefer" — soft enough that it reads as stylistic rather than enforceable. Strengthens it into a stated rule with the reasoning: `NULL` and `''` both read as "nothing," so allowing both on the same attribute forces every query and every `make()` body to handle two representations of the same absence.

Surfaced by a live example: `datajoint-python#1548`'s own new test fixtures defaulted `varchar` attributes to `NULL` rather than `''`.

NULL and '' both read as "nothing," and allowing both on a string
attribute forces every query and make() body to handle two
representations of the same absence. Surfaced by a live example in
datajoint-python#1548, whose own new test fixtures defaulted varchar
attributes to NULL.
An enum's closed value set is exactly the place to add '' as an
explicit member rather than reaching for NULL — no reason to layer a
second absence-mechanism on a type that already enumerates its
allowed values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants