title: Custom domain array by recurrency of custom domain
body: <p>Documentation <a href="https://www.postgresql.org/docs/current/static/sql-createdomain.html" rel="nofollow noreferrer"><em>say nothing</em></a> about create a domain from other custom domains.</p>
  
  <p>I need only to create array of (previously created) custom domains, so it is <strong>not</strong> the <a href="https://stackoverflow.com/q/43259089/287948">problem/solution discussed here</a>.</p>
  
  <p>Example: </p>
  
  <pre><code>CREATE DOMAIN jbag AS JSONb
    CHECK(  VALUE IS NULL OR  jsonb_typeof(VALUE) IN ('object','null')  );  
  </code></pre>
  
  <p>But PostgreSQL not accepting declations like <code>CREATE FUNCTION intersection(jbag[]) RETURNS jbag</code>.</p>
  
  <p>How to do a kind of <code>CREATE DOMAIN jbag[] AS jbag[]</code>?... Or say to postgresql-parser "hello let's accept arrays of atomic custom types!"?</p>
  
  <hr>
  
  <p>For details see <a href="https://github.com/datasets-br/sql-json-bags/blob/master/bag.sql" rel="nofollow noreferrer">bag.sql</a></p>