Skip to content

normalizeCastPositionType

normalizeCastPositionType(sqlType): string

Defined in: packages/contracts/src/registry.ts:1294

serial/bigserial/smallserial are DDL-position conveniences (an integer column plus a sequence default), NOT real cast-position types: json_to_recordset(… AS x(id serial)) and value::serial are both invalid SQL. SyncColumnType.sqlType is contracted to be usable verbatim as a cast type, so we normalise the serial family to its underlying integer type here — the single derivation point — which also lets the column classify as COPY-safe rather than falling to the insert floor.

Exported so any code deriving a SyncColumnType from a bare Drizzle column (e.g. test-support makeApplyTarget, which cannot go through deriveSyncColumnTypes without a registry entry) stays byte-faithful to this single normalisation rather than re-getSQLType()ing without it.

string

string