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