You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
WHEREt.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?
The text was updated successfully, but these errors were encountered:
Hey, im trying to update multiple rows with a real[] column.
My approach is this:
const data = [[123, [1.2,3.4,5.6]], ... ]
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 usingconst data = [[123, '{' [1.2,3.4,5.6].join(',') '}'], ... ]
.Am I doing something wrong?
The text was updated successfully, but these errors were encountered: