title: Postgres Array Append & Array Length for 'Array Push'
body: <p><strong>What is the best way to add an element to an array when the size of the array is not provided?</strong></p>
  
  <p>With <code>array_append</code> this is what I can think of:</p>
  
  <pre><code>UPDATE table SET array = array_append((SELECT array FROM table WHERE ...), 'element') WHERE ...;
  </code></pre>
  
  <p>With <code>array_length</code> this is what I can think of:</p>
  
  <pre><code>UPDATE table SET array[array_length((SELECT array FROM table WHERE ...), 1)+1] = element;
  </code></pre>