title: malformed array literal - PostgreSQL
body: <p>I want to copy an array from jsonb field to a PostgreSQL array column:</p>
  
  <pre><code>CREATE TABLE survey_results (
      id integer NOT NULL,
      areas text[],  
      raw jsonb DEFAULT '{}'::jsonb
  );
  
  INSERT INTO survey_results (id, raw)
      VALUES (1, '{"areas": ["test", "test2"]}');
  
  UPDATE survey_results SET areas = CAST(raw#&gt;&gt;'{areas}' AS text[]);
  </code></pre>
  
  <p>This returns me?</p>
  
  <pre><code>ERROR: malformed array literal: "["test", "test2"]" Detail: "[" must introduce explicitly-specified array dimensions.
  </code></pre>
  
  <p>How can I fix that?</p>
  
  <p><a href="http://sqlfiddle.com/#!17/d8122/2" rel="noreferrer">http://sqlfiddle.com/#!17/d8122/2</a></p>