title: PostgreSQL array error
body: <p>I am new at <code>PostgreSQL</code> , I create 2 table </p>
  
  <pre><code>CREATE TABLE HOUR(
  id integer,
  hour timestamp ) ;
  
  CREATE TABLE ACTIVITY_TIME(
  id integer,
  day_hours varchar[][] ) ;
  </code></pre>
  
  <p><code>day_hours</code> column is a <code>array</code> of combinations number of week, and id of <code>HOUR</code> table .Value of that column look like <code>{{1,5},{2,5},{2,6}}</code>. I tried creat a trigger, when i delete a <code>hour</code> from <code>HOURS</code> table , in <code>ACTIVITY_TIME</code> I have to remove in day_hours where that hour is exist . For example, if I delete <code>id=6</code> from <code>HOUR</code> the result of <code>day_hours</code> will be <code>{{1,5},{2,5}}</code> , or if <code>day_hours</code> <code>{{3,2},{3,4},{4,2}}</code> and if I delete <code>id=2</code> from <code>HOUR</code> the result of <code>day_hours</code> will be <code>{{3,4}}</code>. I know how write trigger, but I can't write the <code>procedure</code> which is execute array</p>
  
  <pre><code>WITH summary AS (
      SELECT
          "unnest" (
              "DAY_HOURS" [ 1 : array_length("DAY_HOURS",1)][ 1 : 1 ]:: INT []
          ) AS days,
          "unnest" (
              "DAY_HOURS" [ 1 : array_length("DAY_HOURS",1)][ 2 : 2 ]:: INT []
          ) AS hours
      FROM
          "ACTIVITY_TIME"
      WHERE
          "ID" = 3
  ) 
  
  SELECT ARRAY(SELECT ARRAY[ s.days,s.hours] FROM
      summary s WHERE s.hours!= 2 )
  </code></pre>
  
  <p>This give <code>error :could not find array type for data type integer[]</code> error, </p>