title: Arrays of custom type in PostgreSQL
body: <p>I have a custom type in Postgres:</p>
  
  <pre><code>CREATE TYPE child AS
     (id integer,
      name text,
      surname text,
      age integer);
  </code></pre>
  
  <p>and table </p>
  
  <pre><code>CREATE TABLE parent
  (
    id integer NOT NULL,
    name text NOT NULL,
    surname text NOT NULL,
    age integer NOT NULL,
    childs child[],
    CONSTRAINT parent_pkey PRIMARY KEY (id)
  )
  </code></pre>
  
  <p>and I want to get parents which have a child who has a name = "John" </p>
  
  <p>I tried something like that:</p>
  
  <pre><code>select id, name
    from parent
  where 'John' = any  (select (unnest(childs)).name from parent)
  </code></pre>
  
  <p>but I received all parents. 
  I would be so grateful when someone solve my problem.</p>