sqlite-diff-rs 0.2.0

Build SQLite changeset and patchset binary formats programmatically, without SQLite
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
//! `Decoder` implementations and `TypeMapDefaults` for the `PgWalstream` source.

use alloc::string::ToString;
use alloc::vec::Vec;

use super::decoder::{
    BoolDecoder, DateVerbatimDecoder, DecimalTextDecoder, Decoder, Int64OverflowToTextDecoder,
    IntDecoder, IntervalVerbatimDecoder, JsonCanonicalDecoder, JsonVerbatimDecoder,
    MySqlBinaryDecoder, NullDecoder, PgByteaBinaryDecoder, PgByteaTextModeDecoder, RealDecoder,
    TextDecoder, TimeVerbatimDecoder, TimestampTzVerbatimDecoder, TimestampVerbatimDecoder,
    UuidBlob16Decoder, UuidText36Decoder,
};
use super::error::DecodeError;
use super::type_map::{TypeMap, TypeMapDefaults};
use crate::encoding::Value;
use crate::pg_walstream::{ColumnValue, PgWalstream, PgWalstreamColumn};

impl<S, B> Decoder<PgWalstream, S, B> for NullDecoder {
    fn decode(&self, _payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        Ok(Value::Null)
    }
}

/// Postgres bool OID. Registered under this key by
/// [`TypeMapDefaults::defaults`].
pub const PG_BOOL: crate::pg_walstream::Oid = 16;

// ------------------------------------------------------------------
// BoolDecoder
//
// pg_walstream text mode: `"t"` -> 1, `"f"` -> 0.
// pg_walstream binary mode: single byte 0x01 -> 1, 0x00 -> 0.
// Null pass-through.
// Anything else -> WrongPayloadKind.
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for BoolDecoder {
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Text(_) => match payload.data.as_str() {
                Some("t") => Ok(Value::Integer(1)),
                Some("f") => Ok(Value::Integer(0)),
                other => Err(DecodeError::WrongPayloadKind {
                    column: payload.column_name.to_string(),
                    expected: "\"t\" or \"f\"",
                    actual: match other {
                        Some(_) => "arbitrary text",
                        None => "non-utf8 bytes",
                    },
                }),
            },
            ColumnValue::Binary(b) => match b.as_ref() {
                [0x01] => Ok(Value::Integer(1)),
                [0x00] => Ok(Value::Integer(0)),
                _ => Err(DecodeError::WrongPayloadKind {
                    column: payload.column_name.to_string(),
                    expected: "single byte 0x00 or 0x01",
                    actual: "other binary contents",
                }),
            },
        }
    }
}

/// Postgres `int2` OID (SMALLINT).
pub const PG_INT2: crate::pg_walstream::Oid = 21;
/// Postgres `int4` OID (INTEGER).
pub const PG_INT4: crate::pg_walstream::Oid = 23;
/// Postgres `int8` OID (BIGINT).
pub const PG_INT8: crate::pg_walstream::Oid = 20;

// ------------------------------------------------------------------
// IntDecoder
//
// Text mode: base-10 parse via `str::parse::<i64>`. Overflow raises
// `IntegerOverflow`. Binary mode: width inferred from OID (int2 = 2
// bytes, int4 = 4, int8 = 8), big-endian. Null pass-through.
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for IntDecoder {
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Text(_) => {
                let s = payload
                    .data
                    .as_str()
                    .ok_or_else(|| DecodeError::InvalidUtf8 {
                        column: payload.column_name.to_string(),
                    })?;
                match s.parse::<i64>() {
                    Ok(i) => Ok(Value::Integer(i)),
                    Err(_)
                        if s.trim_start_matches('-')
                            .chars()
                            .all(|c| c.is_ascii_digit()) =>
                    {
                        Err(DecodeError::IntegerOverflow {
                            column: payload.column_name.to_string(),
                            digits: s.to_string(),
                        })
                    }
                    Err(_) => Err(DecodeError::WrongPayloadKind {
                        column: payload.column_name.to_string(),
                        expected: "base-10 signed integer",
                        actual: "non-numeric text",
                    }),
                }
            }
            ColumnValue::Binary(b) => {
                decode_pg_int_binary(payload.column_name, payload.oid, b.as_ref())
            }
        }
    }
}

fn decode_pg_int_binary<S, B>(
    column_name: &str,
    oid: crate::pg_walstream::Oid,
    bytes: &[u8],
) -> Result<Value<S, B>, DecodeError> {
    match (oid, bytes.len()) {
        (PG_INT2, 2) => {
            let arr: [u8; 2] = bytes.try_into().unwrap();
            Ok(Value::Integer(i16::from_be_bytes(arr).into()))
        }
        (PG_INT4, 4) => {
            let arr: [u8; 4] = bytes.try_into().unwrap();
            Ok(Value::Integer(i32::from_be_bytes(arr).into()))
        }
        (PG_INT8, 8) => {
            let arr: [u8; 8] = bytes.try_into().unwrap();
            Ok(Value::Integer(i64::from_be_bytes(arr)))
        }
        _ => Err(DecodeError::WrongPayloadKind {
            column: column_name.to_string(),
            expected: "int2, int4, or int8 binary with matching byte width",
            actual: "OID and byte width disagreement",
        }),
    }
}

// ------------------------------------------------------------------
// Int64OverflowToTextDecoder
//
// pg_walstream rarely surfaces true bigint-unsigned overflow (Postgres
// has no such type), but this decoder tolerates the shape for
// symmetry with the Maxwell path. Wire text that does not fit i64
// stays as base-10 digits in Value::Text.
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for Int64OverflowToTextDecoder
where
    S: From<alloc::string::String>,
{
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Text(_) => {
                let s = payload
                    .data
                    .as_str()
                    .ok_or_else(|| DecodeError::InvalidUtf8 {
                        column: payload.column_name.to_string(),
                    })?;
                match s.parse::<i64>() {
                    Ok(i) => Ok(Value::Integer(i)),
                    Err(_)
                        if s.trim_start_matches('-')
                            .chars()
                            .all(|c| c.is_ascii_digit()) =>
                    {
                        Ok(Value::Text(S::from(s.to_string())))
                    }
                    Err(_) => Err(DecodeError::WrongPayloadKind {
                        column: payload.column_name.to_string(),
                        expected: "base-10 integer text",
                        actual: "non-numeric text",
                    }),
                }
            }
            ColumnValue::Binary(_) => Err(DecodeError::WrongPayloadKind {
                column: payload.column_name.to_string(),
                expected: "text-mode integer",
                actual: "binary payload",
            }),
        }
    }
}

/// Postgres `float4` OID (REAL).
pub const PG_FLOAT4: crate::pg_walstream::Oid = 700;
/// Postgres `float8` OID (DOUBLE PRECISION).
pub const PG_FLOAT8: crate::pg_walstream::Oid = 701;

// ------------------------------------------------------------------
// RealDecoder
//
// Text mode: `str::parse::<f64>` accepts "NaN"/"Infinity"/"-Infinity"
// and standard decimal / exponential forms. NaN normalizes to Null,
// -0.0 normalizes to 0.0 (matching the crate's `decode_value`).
// Binary mode: float4 = 4-byte big-endian IEEE 754, float8 = 8-byte.
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for RealDecoder {
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Text(_) => {
                let s = payload
                    .data
                    .as_str()
                    .ok_or_else(|| DecodeError::InvalidUtf8 {
                        column: payload.column_name.to_string(),
                    })?;
                match s.parse::<f64>() {
                    Ok(f) => Ok(normalize_real(f)),
                    Err(_) => Err(DecodeError::WrongPayloadKind {
                        column: payload.column_name.to_string(),
                        expected: "IEEE 754 float text",
                        actual: "non-numeric text",
                    }),
                }
            }
            ColumnValue::Binary(b) => {
                decode_pg_real_binary(payload.column_name, payload.oid, b.as_ref())
            }
        }
    }
}

#[inline]
fn normalize_real<S, B>(f: f64) -> Value<S, B> {
    if f.is_nan() {
        Value::Null
    } else if f == 0.0 {
        Value::Real(0.0)
    } else {
        Value::Real(f)
    }
}

fn decode_pg_real_binary<S, B>(
    column_name: &str,
    oid: crate::pg_walstream::Oid,
    bytes: &[u8],
) -> Result<Value<S, B>, DecodeError> {
    match (oid, bytes.len()) {
        (PG_FLOAT4, 4) => {
            let arr: [u8; 4] = bytes.try_into().unwrap();
            Ok(normalize_real(f64::from(f32::from_be_bytes(arr))))
        }
        (PG_FLOAT8, 8) => {
            let arr: [u8; 8] = bytes.try_into().unwrap();
            Ok(normalize_real(f64::from_be_bytes(arr)))
        }
        _ => Err(DecodeError::WrongPayloadKind {
            column: column_name.to_string(),
            expected: "float4 or float8 binary with matching byte width",
            actual: "OID and byte width disagreement",
        }),
    }
}

/// Postgres `text` OID.
pub const PG_TEXT: crate::pg_walstream::Oid = 25;
/// Postgres `varchar` OID.
pub const PG_VARCHAR: crate::pg_walstream::Oid = 1043;
/// Postgres `bpchar` (character) OID.
pub const PG_BPCHAR: crate::pg_walstream::Oid = 1042;
/// Postgres `name` OID.
pub const PG_NAME: crate::pg_walstream::Oid = 19;

// ------------------------------------------------------------------
// TextDecoder
//
// Text mode: UTF-8 validate, pass through as Value::Text. Invalid
// UTF-8 raises `InvalidUtf8` rather than silently coercing to a Blob.
// Binary mode is rejected for text columns.
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for TextDecoder
where
    S: From<alloc::string::String>,
{
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Text(_) => {
                let s = payload
                    .data
                    .as_str()
                    .ok_or_else(|| DecodeError::InvalidUtf8 {
                        column: payload.column_name.to_string(),
                    })?;
                Ok(Value::Text(S::from(s.to_string())))
            }
            ColumnValue::Binary(_) => Err(DecodeError::WrongPayloadKind {
                column: payload.column_name.to_string(),
                expected: "UTF-8 text",
                actual: "binary payload",
            }),
        }
    }
}

/// Postgres `bytea` OID.
pub const PG_BYTEA: crate::pg_walstream::Oid = 17;

// ------------------------------------------------------------------
// PgByteaBinaryDecoder
//
// Handles both `ColumnValue::Binary` (pass-through) and text-mode
// `\xHEX` (decoded via the vendored helper). Null pass-through.
// This is the recommended default for PG_BYTEA columns since it
// tolerates both transport modes.
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for PgByteaBinaryDecoder
where
    B: From<Vec<u8>>,
{
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Binary(b) => Ok(Value::Blob(B::from(b.to_vec()))),
            ColumnValue::Text(_) => {
                let s = payload
                    .data
                    .as_str()
                    .ok_or_else(|| DecodeError::InvalidUtf8 {
                        column: payload.column_name.to_string(),
                    })?;
                match super::bytes_helpers::decode_pg_hex_escape(s) {
                    Ok(bytes) => Ok(Value::Blob(B::from(bytes))),
                    Err(at) => Err(DecodeError::InvalidHexEscape {
                        column: payload.column_name.to_string(),
                        at,
                    }),
                }
            }
        }
    }
}

// ------------------------------------------------------------------
// UuidBlob16Decoder and UuidText36Decoder
//
// Both accept 36-character hyphenated and braced forms of a UUID
// wire text and produce `Value::Blob([u8; 16])` or `Value::Text(36)`
// respectively. Neither is registered in `defaults()`. Users pick
// per column.
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for UuidBlob16Decoder
where
    B: From<Vec<u8>>,
{
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        decode_pg_uuid_to_blob(payload)
    }
}

impl<S, B> Decoder<PgWalstream, S, B> for UuidText36Decoder
where
    S: From<alloc::string::String>,
{
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        decode_pg_uuid_to_text(payload)
    }
}

fn decode_pg_uuid_to_blob<S, B>(payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError>
where
    B: From<Vec<u8>>,
{
    match payload.data {
        ColumnValue::Null => Ok(Value::Null),
        ColumnValue::Text(_) => {
            let s = payload
                .data
                .as_str()
                .ok_or_else(|| DecodeError::InvalidUtf8 {
                    column: payload.column_name.to_string(),
                })?;
            match super::uuid_helpers::parse_uuid(s) {
                Ok(bytes) => Ok(Value::Blob(B::from(bytes.to_vec()))),
                Err(source_len) => Err(DecodeError::InvalidUuid {
                    column: payload.column_name.to_string(),
                    source_len,
                }),
            }
        }
        ColumnValue::Binary(_) => Err(DecodeError::WrongPayloadKind {
            column: payload.column_name.to_string(),
            expected: "UUID text form",
            actual: "binary payload",
        }),
    }
}

fn decode_pg_uuid_to_text<S, B>(payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError>
where
    S: From<alloc::string::String>,
{
    match payload.data {
        ColumnValue::Null => Ok(Value::Null),
        ColumnValue::Text(_) => {
            let s = payload
                .data
                .as_str()
                .ok_or_else(|| DecodeError::InvalidUtf8 {
                    column: payload.column_name.to_string(),
                })?;
            match super::uuid_helpers::preserve_or_canonicalize_uuid_text(s) {
                Ok(canonical) => Ok(Value::Text(S::from(canonical))),
                Err(source_len) => Err(DecodeError::InvalidUuid {
                    column: payload.column_name.to_string(),
                    source_len,
                }),
            }
        }
        ColumnValue::Binary(_) => Err(DecodeError::WrongPayloadKind {
            column: payload.column_name.to_string(),
            expected: "UUID text form",
            actual: "binary payload",
        }),
    }
}

/// Postgres `numeric` OID.
pub const PG_NUMERIC: crate::pg_walstream::Oid = 1700;

// ------------------------------------------------------------------
// DecimalTextDecoder
// ------------------------------------------------------------------

impl<S, B> Decoder<PgWalstream, S, B> for DecimalTextDecoder
where
    S: From<alloc::string::String>,
{
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Text(_) => {
                let s = payload
                    .data
                    .as_str()
                    .ok_or_else(|| DecodeError::InvalidUtf8 {
                        column: payload.column_name.to_string(),
                    })?;
                Ok(Value::Text(S::from(s.to_string())))
            }
            ColumnValue::Binary(_) => Err(DecodeError::WrongPayloadKind {
                column: payload.column_name.to_string(),
                expected: "text-mode numeric",
                actual: "binary payload",
            }),
        }
    }
}

// PgByteaTextModeDecoder and MySqlBinaryDecoder are wire-format
// specific to wal2json / maxwell respectively; on pg_walstream they
// stay NotYetImplemented.

macro_rules! not_yet_impl {
    ($decoder:ty) => {
        impl<S, B> Decoder<PgWalstream, S, B> for $decoder {
            fn decode(&self, _payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
                Err(DecodeError::NotYetImplemented {
                    decoder: stringify!($decoder),
                })
            }
        }
    };
}

/// Postgres `timestamp` OID.
pub const PG_TIMESTAMP: crate::pg_walstream::Oid = 1114;
/// Postgres `timestamptz` OID.
pub const PG_TIMESTAMPTZ: crate::pg_walstream::Oid = 1184;
/// Postgres `date` OID.
pub const PG_DATE: crate::pg_walstream::Oid = 1082;
/// Postgres `time` OID.
pub const PG_TIME: crate::pg_walstream::Oid = 1083;
/// Postgres `interval` OID.
pub const PG_INTERVAL: crate::pg_walstream::Oid = 1186;

// ------------------------------------------------------------------
// Temporal verbatim decoders
//
// Preserve wire text form as `Value::Text`. Null pass-through.
// Reject binary payloads.
// ------------------------------------------------------------------

fn decode_pg_text_verbatim<S, B>(payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError>
where
    S: From<alloc::string::String>,
{
    match payload.data {
        ColumnValue::Null => Ok(Value::Null),
        ColumnValue::Text(_) => {
            let s = payload
                .data
                .as_str()
                .ok_or_else(|| DecodeError::InvalidUtf8 {
                    column: payload.column_name.to_string(),
                })?;
            Ok(Value::Text(S::from(s.to_string())))
        }
        ColumnValue::Binary(_) => Err(DecodeError::WrongPayloadKind {
            column: payload.column_name.to_string(),
            expected: "text form",
            actual: "binary payload",
        }),
    }
}

macro_rules! verbatim_impl {
    ($decoder:ty) => {
        impl<S, B> Decoder<PgWalstream, S, B> for $decoder
        where
            S: From<alloc::string::String>,
        {
            fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
                decode_pg_text_verbatim(payload)
            }
        }
    };
}

verbatim_impl!(TimestampVerbatimDecoder);
verbatim_impl!(TimestampTzVerbatimDecoder);
verbatim_impl!(DateVerbatimDecoder);
verbatim_impl!(TimeVerbatimDecoder);
verbatim_impl!(IntervalVerbatimDecoder);

verbatim_impl!(JsonVerbatimDecoder);

// For pg_walstream, JSON canonical is the same as verbatim because
// the wire carries JSON as opaque text; canonicalization requires
// re-parsing which lives in the JSON helpers on the wal2json /
// maxwell paths.
impl<S, B> Decoder<PgWalstream, S, B> for JsonCanonicalDecoder
where
    S: From<alloc::string::String>,
{
    fn decode(&self, payload: PgWalstreamColumn<'_>) -> Result<Value<S, B>, DecodeError> {
        match payload.data {
            ColumnValue::Null => Ok(Value::Null),
            ColumnValue::Text(_) => {
                let s = payload
                    .data
                    .as_str()
                    .ok_or_else(|| DecodeError::InvalidUtf8 {
                        column: payload.column_name.to_string(),
                    })?;
                let canon = crate::wire::json_helpers::canonicalize_string(s);
                Ok(Value::Text(S::from(canon)))
            }
            ColumnValue::Binary(_) => Err(DecodeError::WrongPayloadKind {
                column: payload.column_name.to_string(),
                expected: "text-mode JSON",
                actual: "binary payload",
            }),
        }
    }
}

/// Postgres `json` OID.
pub const PG_JSON: crate::pg_walstream::Oid = 114;
/// Postgres `jsonb` OID.
pub const PG_JSONB: crate::pg_walstream::Oid = 3802;

not_yet_impl!(PgByteaTextModeDecoder);
not_yet_impl!(MySqlBinaryDecoder);

impl<S, B> TypeMapDefaults<S, B> for PgWalstream
where
    S: From<alloc::string::String>,
    B: From<Vec<u8>>,
{
    fn defaults() -> TypeMap<Self, S, B> {
        TypeMap::new()
            .with(PG_BOOL, BoolDecoder)
            .with(PG_INT2, IntDecoder)
            .with(PG_INT4, IntDecoder)
            .with(PG_INT8, IntDecoder)
            .with(PG_FLOAT4, RealDecoder)
            .with(PG_FLOAT8, RealDecoder)
            .with(PG_TEXT, TextDecoder)
            .with(PG_VARCHAR, TextDecoder)
            .with(PG_BPCHAR, TextDecoder)
            .with(PG_NAME, TextDecoder)
            .with(PG_BYTEA, PgByteaBinaryDecoder)
            .with(PG_NUMERIC, DecimalTextDecoder)
            .with(PG_TIMESTAMP, TimestampVerbatimDecoder)
            .with(PG_TIMESTAMPTZ, TimestampTzVerbatimDecoder)
            .with(PG_DATE, DateVerbatimDecoder)
            .with(PG_TIME, TimeVerbatimDecoder)
            .with(PG_INTERVAL, IntervalVerbatimDecoder)
            .with(PG_JSON, JsonVerbatimDecoder)
            .with(PG_JSONB, JsonVerbatimDecoder)
    }
}