# v0.2.3 — Non-Determinism Detection and Operational Polish

> **Full technical details:** [v0.2.3.md-full.md](v0.2.3.md-full.md)

**Status: ✅ Released** | **Scope: Small** (~2 weeks)

> Detection and clear warnings for queries that use non-deterministic
> functions, gap closures in CDC and refresh modes, and operational
> convenience improvements.

---

## What problem does this solve?

Some SQL functions produce different results every time they are called —
`now()` returns the current timestamp, `random()` returns a random number.
A stream table defined with such functions will drift from the correct answer
over time, because the differential engine cannot correctly compute the delta
for results that depend on the current time or random values. This release
adds detection and clear guidance for this class of issue, alongside other
operational improvements.

---

## Non-Deterministic Function Detection

If your stream table query uses `now()`, `current_timestamp`, `random()`, or
any other volatile function, pg_trickle will now warn you at creation time
(or refresh time, for existing stream tables) that the results may drift.

An explicit `non_deterministic => true` flag can be passed to acknowledge
the behaviour and suppress the warning, for cases where the drift is
intentional and understood.

*In plain terms:* if you accidentally create a stream table like "orders
placed before NOW()", pg_trickle will tell you that this will become stale
immediately, rather than silently refreshing with increasingly wrong results.

---

## CDC and Refresh Mode Gap Closures

Several edge cases in the interaction between change-data capture (CDC) and
specific refresh modes were identified and resolved:

- IMMEDIATE mode handling of `UPDATE` statements that change primary key
  values
- WAL decoder and trigger-based CDC producing different row ordering in
  specific edge cases
- FULL refresh mode not correctly resetting certain differential state

---

## Operational Convenience

Small but useful additions:

- `pgtrickle.list_stream_tables()` — lists all stream tables with their
  current status in a single readable query
- Better error messages that include the stream table name and a hint about
  the likely cause
- Improved handling of `DROP TABLE` on a source table while a refresh is
  in progress — now produces a clean error rather than a crash

---

## Scope

v0.2.3 is a polish and safety release. The non-determinism detection prevents
a whole class of subtle correctness issues. The operational improvements
reduce friction in daily use.
