title: How to cast json array to text array?
body: <p>This workaround not works</p>
  
  <pre><code>CREATE FUNCTION json_array_castext(json) RETURNS text[] AS $f$
    SELECT array_agg(x::text) FROM json_array_elements($1) t(x);
  $f$ LANGUAGE sql IMMUTABLE;
  
  -- Problem:
  SELECT 'hello'='hello';  -- true...
  SELECT  (json_array_castext('["hello","world"]'))[1] = 'hello'; -- false!
  </code></pre>
  
  <p>So, how to obtain real array of text?</p>
  
  <p>PS: with the supposed "first class citizen" JSONb, the same problem.</p>
  
  <hr>
  
  <p>Edit: after @OtoShavadze good answer (the comment solved!), a <em>manifest for PostgreSQL developers</em>: <strong>Why <code>x::text</code>  is not a cast?</strong> (using pg 9.5.6) and why it not generates an warning or an error? </p>