Skip to content

SubscribeLiveRowsInput

Defined in: packages/client/src/index.ts:1285

The narrow live-rows seam (ADR-0032 S2 §4) both client modes implement so the @pgxsinkit/react hooks work against either. Input for a reactive subscription: the compiled SQL + params (from a Drizzle builder’s .toSQL() or a raw string) and the result’s pkColumns (drives worker-side diff keying; omit for a keyless query). The in-process client runs it directly over pglite.live; the worker-attached client runs the live query in the worker and streams DIFFs across the bridge.

optional fields?: readonly string[]

Defined in: packages/client/src/index.ts:1298

The unique output aliases to render the query’s columns under so it is SAFE TO MATERIALISE, in the compiled SQL’s column order (one per output column). Drizzle emits no output aliases, so a JOIN whose tables share a column name compiles to duplicate output names — which PGlite’s live extension refuses to materialise (column "title" specified more than once) and which silently collapse same-named columns even in a plain query. When supplied, the seam wraps the query so every output column gets its alias and rows come back KEYED BY THESE ALIASES; the consumer’s row-mapper must read by alias (the @pgxsinkit/react hooks do). Omit for a raw or non-colliding query — the seam then leaves the SQL untouched and rows stay keyed by the underlying column names.


optional keepAliveMs?: number

Defined in: packages/client/src/index.ts:1317

Per-subscription keep-alive hint (ms) for the live-query manager (ADR-0040 decision 4): retain this query’s shared registration for the grace period after its last consumer leaves, so a re-mount reuses it verbatim (no re-materialization). Honoured in BOTH modes — the worker manager and the in-process manager (decision 6). Bounded by the liveQueries policy budgets. Absent → no hint.


params: readonly unknown[]

Defined in: packages/client/src/index.ts:1287


optional pkColumns?: readonly string[]

Defined in: packages/client/src/index.ts:1304

The result’s PK columns — the diff-keying identity across the bridge (§4). Omit for a keyless query. When fields is supplied the result columns are the aliases, so a PK column here must be named by its ALIAS (the aliased result column), not the underlying source column.


sql: string

Defined in: packages/client/src/index.ts:1286


optional use?: readonly string[]

Defined in: packages/client/src/index.ts:1310

Lazy relations (ADR-0021) to activate before the query runs — forwarded to the worker so it can prepareQuery before registering the live query (the tab’s own prepareQuery is a no-op against the worker bridge). Ignored by the in-process client, whose prepareQuery already ran on the tab.