'Row value misused' when inserting an array of structs into database

Viewed 33

The following insert query resulted in row value misused error (query generated by golang gorm):

INSERT INTO employees_details (img_uid, img_files) 
VALUES 
  (
    "asfe123y3uygy43", 
    (
      "{\"ImageID\":\"ISDx-Y0fudfhv4lC_M25j\",\"ImageType\":\"original\",\"MediaType\":\"img/png\",\"MediaPath\":\"it-profile/faergbgbder34fgb/original/154895123-owen.png\"}", 
      "{\"ImageID\":\"fgsrtbrdsthrb\",\"ImageType\":\"thumbnail\",\"MediaType\":\"img/png\",\"MediaPath\":\"it-profile/faergbgbder34fgb/thumb/154895123-owen.png\"}"
    )
  )

The column img_files is a column containing an array of structs ([]img_files{string, string, string, string}). When I insert only 1 struct, the query works fine. But when I want to insert two at once (an array of 2 elements), I got row value misused error.

0 Answers
Related