KalamDB v0.5.4-rc.1 Release
KalamDB v0.5.4-rc.1 is the June 25 pre-release for PostgreSQL-style INSERT ... RETURNING and ON CONFLICT upsert, the Live OKF Context Sync example, and CLI, auth, and test hardening.
SQL: INSERT … RETURNING
INSERT statements can now return affected rows directly in the SQL response.
Supported syntax:
Behavior:
RETURNING *returns all table columns in schema orderRETURNING col1, col2, ...returns a selected projection- Works for single-row and multi-row
INSERT - API responses include the returned rows in the standard
results[].rowsshape - Parameterized inserts support
RETURNINGover HTTP and through the SDKs
SQL: INSERT … ON CONFLICT (upsert)
PostgreSQL-style upsert is supported on the primary key conflict target.
| Feature | Behavior |
|---|---|
ON CONFLICT (pk) DO UPDATE SET ... | Updates existing row; unassigned columns are preserved |
EXCLUDED.column | References the proposed insert values |
ON CONFLICT (pk) DO NOTHING | Skips conflicting rows |
DO UPDATE ... WHERE | Applies update only when the predicate is true |
RETURNING with DO NOTHING | Returns zero rows for skipped conflicts |
| Multi-row upsert | One returned row per input row (insert or update) |
| User tables | Conflicts are scoped per user (RLS isolation) |
| Shared tables | Conflicts are global on the primary key |
Limitations (current release):
- Conflict target must be the table’s primary key column
ON CONFLICT ON CONSTRAINTis not supported- Non-primary-key unique targets are rejected with a clear error
TypeScript ORM (@kalamdb/orm)
Drizzle-style upsert and returning now work end-to-end:
Live OKF Context Sync example
A new showcase app under examples/live-okf-context-sync/ demonstrates syncing a Google Open Knowledge Format (OKF) folder into KalamDB for multi-client AI agent context.
- Per-user OKF Markdown folders synced into KalamDB via a Node sync worker
- File metadata in a user-scoped SQL table; bytes via KalamDB
FILEupload/download - Local folder watch (push) +
liveTable()pull with a SQLite hash cache under.index/ - Schema-first workflow:
kalam/schema.sqlis the source of truth; TypeScript types are generated via@kalamdb/orm - Live subscriptions so every sync worker sees metadata changes in realtime
- Delete local
data/and restart — files restore from the server (KalamDB is the source of truth)
Docs: Live OKF Context Sync
CLI and dev workflow
kalam devimprovements — stronger prechecks for auth, paths, and server readiness before starting dev processes- Project init refactor — cleaner scaffolding for TypeScript projects and connection URL handling
- Self-update — more reliable version comparison (version first, then build date for same-version rebuilds)
- Update-check tests — version-bump-proof; no longer require editing hardcoded release numbers on each release
run-tests.sh— improved running-server credential validation and supplementary suite orchestration
Security and auth
- OIDC bearer auth fix — closes a repository bypass where OIDC bearer tokens could skip expected authorization checks
- Auth endpoint hardening — login, setup, and OIDC exchange paths tightened for consistency
Upgrade notes
- Rebuild or update server and CLI to
0.5.4-rc.1 - TypeScript projects — bump
@kalamdb/*packages together; runnpm installto refresh lockfiles - Upsert adoption — replace read-then-write patterns with
ON CONFLICT ... DO UPDATEwhere appropriate - RETURNING — use instead of a follow-up
SELECTafter inserts when you need the written row - OKF example — requires
kalam dev(starts server, applies schema, generates ORM types)
Release post
For the narrative announcement with SQL examples, the OKF context sync summary, and release links, read the KalamDB v0.5.4-rc.1 pre-release blog post.