Closed BigBoulard closed 2 years ago
Unless you need to support NULL
elements in your pictures array I suggest using a []string
directly instead of any pgtype
type. If you do need NULL
try using a pgtype.TextArray
.
If one of those doesn't fix it see if you can reduce the problem to a standalone example.
works! Thank you again
Hi,
First off thank you for the time you take to answer to all these questions, it's impressive.
I'm trying to insert a slice of items and get then back in a Go Struct. Each Item has pictures that is a struct field of type
[]pgtype.Text
(it may be not the good type to be chosen).I can insert the items and their pictures in Postgres, but I get an error when trying to getting it back to the
[]pgtype.Text
can't scan into dest[8]: unable to assign to *pgtype.Text
The type of the Postgres field is
[]text
.Thank you so much for your help (don't hesitate to point out anything weird in the code it's gold to me ;) )
The SELECT part
The INSERT part
The connection part