Reputation: 586
How do I save 2d lists into postgres? Or put matching lengths to lists?
I tried this in my migration..
add :checkpoints, {:array, :string}
and schema..
field :checkpoints, {:array, {:array, :string}}
But when i save this sample value of [["C23", "E12"], ["N34"], ["G22"]]
to :checkpoints field,
I get this error:
(ArgumentError) nested lists must have lists with matching lengths
Upvotes: 1
Views: 514
Reputation: 564
All of our lists need to have the same length. Your first list has three elements, the other ones have only 1.
Upvotes: 5