Skip to content

Table copy follow-up to #222: multi-dimensional arrays, jsonb 1e400, session-path comment newline, GUC leak, jsonb[]/composite inserts #225

Done

Description

@aesslinger

Summary

Retest of #222 against merged main at 47cca76 (release build, PostgreSQL 16). #223 fixed most of #222: array specials and timestamps, interval, money[], bit(n), array inserts, BC dates, the JSON round trip (9 of 9 values read and written back identical), and a trailing -- c. This lists what is still wrong. The BY DEFAULT identity regression is a separate, release-blocking issue (see the linked issue).

The host blocks arrays and reads json as text, so none of these corrupt a copy today. They matter for anyone using read_rows / insert_records directly, and for the host once it supports more types.

1. Silent null on read

read_rows returns null with no error, so it cannot be told from SQL NULL.

Value Returned
multi-dimensional array, '{{1,2},{3,4}}'::int[] null (whole cell)
'1e400'::jsonb null

#223 lists the first as a deferred limitation. Please at least return the PostgreSQL text form ({{1,2},{3,4}}) so the value survives. 1e400 is a valid jsonb (stored as a 401-digit number) and ::text returns it exactly.

2. Changed value on read

  • Array lower bounds are dropped. '[2:3]={1,2}'::int[] reads [1, 2]; the server prints [2:3]={1,2}. fix: array lossless extraction, interval, bit(n), JSON round-trip, BC dates (#222) #223 lists this as deferred.
  • jsonb numbers pass through f64. 12345678901234567890123.5 reads as 1.2345678901234568e+22, and {"a":12345678901234567890123.5} as {"a":1.2345678901234568e+22}. Known limitation in fix: array lossless extraction, interval, bit(n), JSON round-trip, BC dates (#222) #223 (needs serde_json arbitrary_precision). json duplicate keys are collapsed ({"a":1,"a":2} reads {"a":2}).
  • tstzrange still drops the offset. The server prints ["2024-01-01 00:00:00+00","2024-02-01 00:00:00+00"); read_rows returns ["2024-01-01 00:00:00", "2024-02-01 00:00:00"). The value is converted to UTC and the zone dropped, which is equivalent while the session zone is UTC, but the text does not match. Writing the read form back does store the right instant (tested with +05).
  • interval '14 months' reads 14 mons; the server prints 1 year 2 mons. Equal as values, different as text, and the original issue was exact text. (48 hours, 1000000 hours and arrays of intervals are now exact.)

3. insert_records still rejects

  • jsonb[]: Unsupported array element type.
  • Composite types: Cannot bind a JSON object to a non-JSON column. read_rows emits {"x": 1, "y": 2}.

4. Smaller

  • A trailing line comment followed by a newline still breaks the session path. strip_trailing_line_comment (copy.rs:58) only inspects the text after the last \n, so select 1 -- c is fixed but select 1 -- c\n (what a pasted statement usually ends with) fails with DECLARE cursor failed: syntax error at end of input. Trim trailing whitespace before looking for the last line, or scan for a line comment that is the last token.
  • Session GUC leak on the one-shot path. select set_config('probe.leak','yes',false) followed by select current_setting('probe.leak', true) returns yes on the same backend pid, repeatedly. fix: array lossless extraction, interval, bit(n), JSON round-trip, BC dates (#222) #223's description says run_one_shot runs RESET ALL after COMMIT/ROLLBACK; copy.rs:235 still says it deliberately does not (to keep the startup script's GUCs and app.tabularis_base_search_path). If the intent is to clear leaks, DISCARD ALL would also clear the startup script, so a targeted reset of just the caller's variables is needed, or the description should be corrected. Low risk: the host only sends SELECT here.
  • limit: -1 is accepted and reported as page_size: 1000. A negative limit should be rejected, like 0 is clamped.

Verified fixed in #223, for reference

Reads: time[], float4[]/float8[] NaN and Infinity, numeric[] NaN, date[]/timestamp[]/timestamptz[] infinity, timestamp[]/timestamptz[] microseconds and offset, interval and interval[], money[], jsonb string scalars and JSON null. Writes: bit(3)/bit(8)/varbit, timestamptz[], timestamp[], date[], uuid[], numeric[], inet[], int4range[], and BC / year >9999 dates and timestamps in the form read_rows emits.

Activity

  1. aesslinger commented on Dec 3, 2026

    @aesslinger
    CollaboratorAuthor

    Fix is up in #227. Instead of patching more binary decoders, read_rows now reads every non-native column as the server's own ::text. That covers all the read-side items in one change: multi-dimensional arrays, lower bounds, 1e400, big jsonb numbers, json duplicate keys, tstzrange offsets and 14 months. The write-side items (jsonb[] objects, composites) and the smaller ones (-- c\n, the GUC leak, limit: -1) are also fixed there. Contract changes are listed in the PR body.

  2. added a commit that references this issue on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions