Skip to content

buildCopyFromBlobStatement

buildCopyFromBlobStatement(__namedParameters): RawStatement & object

Defined in: packages/client/src/sync/copy.ts:288

Render the COPY <table> (<columns>) FROM '/dev/blob' WITH (FORMAT text) statement for rows, together with the COPY TEXT bytes pgwasm must read for it — a RawStatement whose blob carries the body (narrowed to a non-optional blob: this builder ALWAYS produces one).

This is the ONE implementation of the COPY-from-blob load: the sync applier’s bulk path (applyMessagesToTableWithCopy) and the public raw seam both call it, so an app-owned table bulk-loads on exactly the contract the applier is tested against.

Hand it to rawTransaction (to bulk-load inside one local transaction, e.g. delete-then-COPY) or to rawQuery’s blob option for a single statement. On a worker-attached client the bytes are TRANSFERRED, not copied — see RawStatement.blob: the buffer is detached after the call.

Tier ③ (ADR-0028 allow-list), exactly as the applier’s copy of this statement was: COPY … FROM '/dev/blob' is pgwasm’s blob-ingest grammar and has NO Drizzle builder form, so the statement text stays a raw string. Every identifier in it is still derived — the table from getTableConfig, each column through quoteIdentifier — so nothing in the string is a hand-written identifier.

CopyFromBlobStatementOptions

RawStatement & object