Skip to content

serializeCopyValue

serializeCopyValue(value, udtName?): string

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

Serialize a single value into one COPY TEXT field. null/undefined become the NULL marker (\N); everything else is converted to text and escaped.

udtName is the column’s Postgres udt_name. When supplied it disambiguates json/jsonb columns; when omitted the value’s runtime type is used (which cannot tell a jsonb array from a SQL array).

PUBLIC (re-exported from the package root) so an app that bulk-loads a table pgxsinkit does not manage writes the SAME COPY TEXT the applier does. The value contract is the one this module’s header states: numbers/booleans/ bigints as JS primitives, json/jsonb as parsed values (an object, an array, or a scalar — never pre-stringified JSON, which would land as a JSON string), a Date or its text for the temporal types, a JS array (or the Postgres array text) for an array column, and every other type as a string.

unknown

string

string