Repository navigation
Conversation
The COPY path encoded every list element with `format()`, so a list of integer or character vectors was written as meaningless `bytea` without an error. It now raises "Lists must contain raw vectors or NULL", the error that `dbQuoteLiteral()` and parameter binding already give, and `dbWriteTable()` rolls back the table it created. Lists of raw and blob objects are written as before. Closes #648. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
Question: error or PostgreSQL arrays for list columns that are not lists of raw?Right now The alternative is to map homogeneous atomic list columns to PostgreSQL arrays (
Generated by Claude Code |
…list columns error The error for list columns that are not lists of raw is checked inside a transaction the user opened, which stays usable and keeps its earlier work. An AsIs list of raw still round-trips as `bytea`, and a zero-row data frame with a list column still creates a `bytea` column. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
Question: Keep accepting character hex strings in list columns?On
Generated by Claude Code |
Question: Name the offending column in the error for non-raw list columns?The new error "Lists must contain raw vectors or NULL" does not say which column or row caused it. Packed data-frame columns are also caught, because
Generated by Claude Code |
Accepted limitations
Generated by Claude Code |
Closes #648.
The COPY path in
sql_data_copy()encoded every list element withformat(), so a list column holding integer or character vectors was written as meaninglessbyteawith no error or warning. It now raises "Lists must contain raw vectors or NULL", the same error thatdbQuoteLiteral()(used withcopy = FALSE) and parameter binding already give. BecausedbWriteTable()runs in a transaction, the table it created is rolled back, also inside a transaction the user opened, which stays usable. Lists of raw vectors, AsIs lists of raw andblob::blobcolumns are written as before.dbDataType()still maps any list toBYTEA. DBI'sdbDataType()specification only requires lists of raw vectors and blob objects to be accepted and leaves other types unspecified, and RSQLite 3.54.1 behaves the same way:dbDataType()returnsBLOBfor such a list, anddbWriteTable()fails with "Can only bind lists of raw vectors (or NULL)" without leaving a table behind. Mapping non-raw lists to PostgreSQL arrays instead is asked as a question in a comment below.Tests: self-contained blocks in
tests/testthat/test-dbWriteTable.Rcover the error fordbWriteTable()withcopy = TRUEandcopy = FALSE, fordbAppendTable()and inside a user-openeddbBegin()transaction, as well as the round trip of lists of raw, AsIs lists of raw and blobs asbytea, and a zero-row data frame with a list column.devtools::test()passes locally against PostgreSQL 16.Accepted limitations: see this comment.
The Arrow path (
list<int32>viadbAppendTableArrow()) is coordinated in #631 and not touched here.Session: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
🤖 Generated with Claude Code
https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g