title: PostgreSQL cummulative sum max condition
body: <p>I have the following table:</p>
  <pre><code>account 
  size   id    name 
  100    1     John 
  200    2     Mary 
  300    3     Jane 
  400    4     Anne
  100    5     Mike 
  600    6     Joanne 
  </code></pre>
  <p>I want to partition the rows in groups, where the sum of size &lt;= 600.</p>
  <p>Expected result:</p>
  <pre><code>account 
  group  size   id    name 
  1       100    1     John 
  1       200    2     Mary 
  1       300    3     Jane 
  2       400    4     Anne
  2       100    5     Mike 
  3       600    6     Joanne 
  </code></pre>
  <p>I don't know how to do the partition and add the condition.</p>