Update docs on new table formats - #582
Open
kkin-here wants to merge 15 commits into
Open
Conversation
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
…implementation as far as possible. Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Root cause #1: Guid.ALL_PARTS was still 13 (expecting old uid field) - Guid.kt — removed UID constant, changed ALL_PARTS from 13 to 12. The Guid.fromString() was rejecting valid GUID strings because it expected 13 colon-separated parts (the old format with uid) but the new format only has 12. This caused XyzNs.guid to silently return null, breaking 23 tests. Root cause #2: next_tn/prev_tn/base_tn were B64 (8 bytes = txn only), not unique per feature - All features in the same transaction share the same txn value, so B64 next_tn was identical for all features written in one batch — making history queries by next_tn return all features from that transaction instead of only the intended ones. - Fixed by changing next_tn/prev_tn/base_tn to B128 (16 bytes = featureNumber + txn), which is unique per feature. Files changed: - Guid.kt — removed UID = 12, changed ALL_PARTS to 12 - PgColumnRows.kt — reads/writes prev_tn/next_tn/base_tn with B128 instead of B64 - PgWriterUpdate.kt — history next_tn set to new_row.tn (full B128) - PgWriterUpsert.kt — history next_tn set to naksha_tn_128(...) with action bits; prev_tn set to full head_row.tn; reads prev_tn via getB128 - PgWriterDelete.kt — tombstone next_tn set to naksha_tn_128(...); prev_tn set to full head_row.tn; history next_tn set to tombstone.tn - PgTable.kt — tombstone constraint changed from next_tn = naksha_tn_64(tn) to next_tn = tn - PgColumn.kt — KDocs updated for next_tn/prev_tn/base_tn - ReadFeaturesByOtherTns.kt — test updated to serialize TupleNumbers as B128 for next_tn queries Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Introduces `NakshaCollection.members` (typed user-defined columns) and
`NakshaCollection.indices` (replaces the legacy StringList opt-in list of
built-in indexes). At write time, the storage walks each feature using the
member's JsonPath (defaults to ["properties", name]), coerces the value to
the declared CustomMemberType, and stores it in a real Postgres column
namespaced with `$` (`$age`, `$price`, ...) to avoid collision with built-ins.
The value also remains in the encoded feature blob.
CustomMemberType (model-only, no SQL flavor):
BOOLEAN, INT8/16/32/64, FLOAT32/64, STRING, BYTE_ARRAY,
FLAT_MAP (object of primitives), TAGS (string-array expanded to flat map).
CustomIndexType: BTREE, SPATIAL, FLAT_MAP.
Schema mutability runs on UPSERT/UPDATE of an existing collection:
- same name + same dataType -> no-op
- same name + different dataType -> ILLEGAL_ARGUMENT (no type change)
- new member -> ALTER TABLE ADD COLUMN on HEAD/HISTORY/DELETED/META roots
(nullable, no default - metadata-only on PG 11+)
- removed member -> requires Write.force=true; ALTER TABLE DROP COLUMN
- index identity = (name, type, on, include, unique); any diff -> drop+create
PgIndex.DEFAULT_INDICES is now always applied; the closed-enum opt-in via
`indices: StringList` is removed.
Naming:
- Member/index names use the standard Naksha.verifyId rules (no new regex
or MAX_LENGTH).
- Physical PG column is `$<name>` so user names cannot collide with the
built-in column namespace.
Signed-off-by: kkin-here <284318677+kkin-here@users.noreply.github.com>
Signed-off-by: kkin-here <284318677+kkin-here@users.noreply.github.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
Signed-off-by: kkin-here <284318677+kkin-here@users.noreply.github.com>
kkin-here
marked this pull request as ready for review
May 19, 2026 14:15
xeus2001
previously approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.