title: How to append a new item into the array-type column in PostgreSQL
body: <p>Im using PostgreSQL for my application, </p>
  
  <p>The task will be like this</p>
  
  <p>There are users who use my app, and I need to maintain notification for each of them based on their activity so I get lots and lots of notifications for each user.</p>
  
  <p>so in general we just put all the notifications in a seperate table and we do map with user ID, so we can just fetch them, but now Im thinking to use either json/array datatype, so I can just put the entire notification set as array/json into the cell of each user row.</p>
  
  <p>Which one is better, storing json or array?( Im using PHP at server side)</p>
  
  <p>and if we pick any one among the two, lets say we have some 10 notifications, and I got the 11th one, how do we append the new item into the array/json object in single execution(may be UPDATE statement)?
  I dont want to go in basic way like select the row, get the existing array/json add the new item in the end(process with PHP) and UPDATE it back- here it takes two executions where another change may occur and that brings dataloss</p>
  
  <p>so is there a way to do UPDATE query that just adds a new element or alters the existing element/node in array/json obejct types in PostgreSQL?</p>