Skip to content

Multiple update with array casting issue #741

Closed

Description

@dekdevy

Hey, im trying to update multiple rows with a real[] column.

My approach is this:

const data = [[123, [1.2,3.4,5.6]], ... ]

UPDATE mytable as t
  SET myreal = (v.myreal)::real[]
  FROM (VALUES ${sql(data)}) AS v(id, myreal)
  WHERE t.id = (v.id)::int 

This throws a PG error: malformed array literal: "1.2,3.4,5.6". This leads me to believe that I cannot hand an array in like this as it is being cast to a string and sent directly. I found a workaround using const data = [[123, '{'+[1.2,3.4,5.6].join(',')+'}'], ... ].

Am I doing something wrong?

Activity

  1. added a commit that references this issue on Oct 29, 2026
    06cf284
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions