title: Derived type in PostgreSQL
body: <p>Is it possible to create a "derived type" from a type? Like <code>extends</code> in Java.</p>
  
  <p>For instance I need these types:</p>
  
  <pre><code>create type mytype as (
      f1 int,
      --many other fields...
      fn varchar(10)
  );
  
  create type mytype_extended as (
      f1 int,
      --many other fields...
      fn varchar(10),
  
      fx int --one field more
  );
  </code></pre>
  
  <p>You can see that this is redundant. If in the future I'll change <code>mytype</code>, I'll need to change <code>mytype_extended</code> too.</p>
  
  <p>I tried this:</p>
  
  <pre><code>create type mytype as (
      f1 int,
      --many other fields...
      fn varchar(10)
  );
  
  create type mytype_extended as (
      mt mytype,
  
      fx int --one field more
  );
  </code></pre>
  
  <p>but this leads <code>mytype_extended</code> to have just 2 fields, <code>mt</code> (a complex type, I think) and <code>fx</code>, instead of <code>f1, f2... fn, fx</code>.</p>
  
  <p>Is there a way to accomplish this?</p>