I am trying to insert a series of values from an array of jsonb into postgres. However, I get the error error: invalid input syntax for uuid:.
My data looks like so
[
  {
    code: "dwfwradsa",
    purpose: "description",
    id: uuid (real uuid, this is just a placeholder)
  },
  {repeat},
  {repeat}
]
And the relevant part of my function is as follows. @codes is a parameter passed into the function.
  INSERT INTO
    "codes" (
      "code",
      "purpose",
      "id"
    )
  SELECT
    codes->>'code',
    codes->>'purpose',
    codes->>'id'::UUID -- this is a foreign key from another table
  FROM jsonb_array_elements("@codes") codes
  ON CONFLICT ON CONSTRAINT unique_code DO NOTHING;
Even casting seems to not fix the problem.
If I do not cast, I receive this error error: column "column_name" is of type uuid but expression is of type text.
