@crvouga/mockingbird-service-postgres 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,8 @@ export declare const PACK_BLOB = 6;
10
10
  export declare const PACK_TAGGED = 7;
11
11
  export interface SlabColumn {
12
12
  pack: number;
13
+ /** PACK_INT uses the SQL type to retain bigint datums even inside the safe integer range. */
14
+ integerBigInt?: boolean;
13
15
  nullBitmap: Uint8Array | null;
14
16
  /** Prefix sum of non-null rows for O(1) null-index lookup. */
15
17
  nonNullPrefix?: Uint32Array;
package/dist/wire/cli.js CHANGED
@@ -28358,7 +28358,7 @@ function readSlabCell(column, rowIndex, intern, rowCount) {
28358
28358
  }
28359
28359
  if (pack === PACK_INT) {
28360
28360
  const integer2 = view.getBigInt64(nonNullIndex * 8, true);
28361
- return integer2 <= BigInt(Number.MAX_SAFE_INTEGER) && integer2 >= BigInt(Number.MIN_SAFE_INTEGER) ? Number(integer2) : integer2;
28361
+ return !column.integerBigInt && integer2 <= BigInt(Number.MAX_SAFE_INTEGER) && integer2 >= BigInt(Number.MIN_SAFE_INTEGER) ? Number(integer2) : integer2;
28362
28362
  }
28363
28363
  if (pack === PACK_TEXT_INTERN) {
28364
28364
  const id = view.getUint32(nonNullIndex * 4, true);
@@ -28919,7 +28919,8 @@ function decodeInner(snapshot, prng, clock) {
28919
28919
  if (meta.stats) state.tableStats.set(table.oid, meta.stats);
28920
28920
  const rowCount = readVarintU32(r);
28921
28921
  const slabColumns = [];
28922
- for (let c = 0; c < meta.columns.length; c++) slabColumns.push(readPackedColumn(r, rowCount, intern));
28922
+ for (let c = 0; c < meta.columns.length; c++)
28923
+ slabColumns.push(readPackedColumn(r, rowCount, intern, meta.columns[c].type.id));
28923
28924
  table.attachSlab(new ColumnarSlab(snapshot, rowCount, slabColumns, intern));
28924
28925
  schema.tables.set(table.name, table);
28925
28926
  }
@@ -28932,7 +28933,7 @@ function decodeInner(snapshot, prng, clock) {
28932
28933
  const matRowCount = readVarintU32(r);
28933
28934
  const width = readVarintU32(r);
28934
28935
  const cols = [];
28935
- for (let c = 0; c < width; c++) cols.push(readPackedColumn(r, matRowCount, intern));
28936
+ for (let c = 0; c < width; c++) cols.push(readPackedColumn(r, matRowCount, intern, meta.matColumns?.[c]?.type));
28936
28937
  const slab = new ColumnarSlab(snapshot, matRowCount, cols, intern);
28937
28938
  matRows = slab.materialize();
28938
28939
  }
@@ -29204,7 +29205,7 @@ function writePackedColumn(w, rows, col, internId, forceId) {
29204
29205
  writeTaggedDatum(w, rows[i][col], internId, forceId);
29205
29206
  }
29206
29207
  }
29207
- function readPackedColumn(r, n, intern) {
29208
+ function readPackedColumn(r, n, intern, type) {
29208
29209
  const pack = r.u8();
29209
29210
  if (pack === PACK_NULL) return { pack, nullBitmap: null, payload: new Uint8Array(0) };
29210
29211
  const bits = r.raw(n + 7 >> 3);
@@ -29217,7 +29218,8 @@ function readPackedColumn(r, n, intern) {
29217
29218
  r.skipAlign4();
29218
29219
  const width = 8;
29219
29220
  const payload = r.raw(nonNull * width);
29220
- return { pack, nullBitmap: bits, payload };
29221
+ const integerBigInt = type !== void 0 && ["int8", "money", "time", "timestamp", "timestamptz"].includes(type);
29222
+ return { pack, nullBitmap: bits, payload, integerBigInt };
29221
29223
  }
29222
29224
  if (pack === PACK_TEXT_INTERN) {
29223
29225
  r.skipAlign4();