Skip to content

Bug report: pq_jsonb (RPostgres) + disjoint data.frame columns causes vec_rbind() error and vec_c() crash #2148

@yusuke-sasaki-jprep

Description

@yusuke-sasaki-jprep

Summary

When combining base data.frames that contain a pq_jsonb column (class from RPostgres) and disjoint column names, I see two problematic behaviors in vctrs 0.7.1 on Windows:

  1. vctrs::vec_rbind() errors with an incompatible type message involving <vctrs:::common_class_fallback>.
  2. vctrs::vec_c() causes an R session crash (hard crash; process terminates), so I cannot include it as a standard reprex output.

Expected result

I expected vec_rbind() to return a 2-row data.frame with the union of columns x and y, and missing values filled with NA (both columns retaining the <pq_jsonb> class), e.g.:

Row 1: x = NA<pq_jsonb>, y = NA<pq_jsonb>
Row 2: x = NA<pq_jsonb>, y = NA<pq_jsonb>

However, due to my lack of understanding of vctrs, I apologize in advance if the expected output is incorrect.

Reprex (non-crashing parts)

# combine as same column name: OK
a <- vctrs::vec_rbind(
  data.frame(
    x = structure(NA_character_, class = "pq_jsonb")
  ),
  data.frame(
    x = structure(NA_character_, class = "pq_jsonb")
  )
)

a$x
#> [1] NA NA
#> attr(,"class")
#> [1] "pq_jsonb"


b <- vctrs::vec_c(
  data.frame(
    x = structure(NA_character_, class = "pq_jsonb")
  ),
  data.frame(
    x = structure(NA_character_, class = "pq_jsonb")
  )
)

b$x
#> [1] NA NA
#> attr(,"class")
#> [1] "pq_jsonb"


# combine as different column name: ERROR
vctrs::vec_rbind(
  data.frame(
    x = structure(NA_character_, class = "pq_jsonb")
  ),
  data.frame(
    y = structure(NA_character_, class = "pq_jsonb")
  )
)
#> Error in `vctrs::vec_rbind()`:
#> ! Can't combine `..1` <pq_jsonb> and `..2` <vctrs:::common_class_fallback>.

Created on 2026-03-10 with reprex v2.1.1

Session info

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.5.2 (2025-10-31 ucrt)
#>  os       Windows 11 x64 (build 26200)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  Japanese_Japan.utf8
#>  ctype    Japanese_Japan.utf8
#>  tz       Asia/Tokyo
#>  date     2026-03-10
#>  pandoc   3.6.3 @ c:\\Program Files\\Positron\\resources\\app\\quarto\\bin\\tools/ (via rmarkdown)
#>  quarto   NA
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  cli           3.6.5      2025-04-23 [1] CRAN (R 4.5.1)
#>  digest        0.6.39     2025-11-19 [1] CRAN (R 4.5.0)
#>  evaluate      1.0.5      2025-08-27 [1] CRAN (R 4.5.1)
#>  fastmap       1.2.0      2024-05-15 [1] CRAN (R 4.5.1)
#>  fs            1.6.7      2026-03-06 [1] CRAN (R 4.5.2)
#>  glue          1.8.0      2024-09-30 [1] CRAN (R 4.5.1)
#>  htmltools     0.5.9      2025-12-04 [1] CRAN (R 4.5.2)
#>  knitr         1.51       2025-12-20 [1] CRAN (R 4.5.2)
#>  lifecycle     1.0.5      2026-01-08 [1] CRAN (R 4.5.2)
#>  otel          0.2.0      2025-08-29 [1] CRAN (R 4.5.1)
#>  pillar        1.11.1     2025-09-17 [1] CRAN (R 4.5.0)
#>  reprex        2.1.1      2024-07-06 [1] CRAN (R 4.5.1)
#>  rlang         1.1.7      2026-01-09 [1] CRAN (R 4.5.2)
#>  rmarkdown     2.30       2025-09-28 [1] CRAN (R 4.5.1)
#>  sessioninfo   1.2.3.9000 2025-11-25 [1] Github (r-lib/sessioninfo@d4e98a4)
#>  vctrs         0.7.1      2026-01-23 [1] CRAN (R 4.5.2)
#>  withr         3.0.2      2024-10-28 [1] CRAN (R 4.5.1)
#>  xfun          0.56       2026-01-18 [1] CRAN (R 4.5.2)
#>  yaml          2.3.12     2025-12-10 [1] CRAN (R 4.5.2)
#> 
#>  [1] C:/Users/user_name/AppData/Local/R/win-library/4.5
#>  [2] C:/Program Files/R/R-4.5.2/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Reprex (crashing parts)

vctrs::vec_c(
  data.frame(
    x = structure(NA_character_, class = "pq_jsonb")
  ),
  data.frame(
    y = structure(NA_character_, class = "pq_jsonb")
  )
)

# R 4.5.2 exited unexpectedly: exit code -1073741819

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