How to "group" based on consecutive occurrences of an element in a column in postgres
I personally think this is not a good design because all intermediate stop points must be included into two segments. 

IMHO, you should be able to transform it into something similar to:

id | start | end | stop
---|-------|-----|-----
 1 |   1   |  2  |
 2 |   2   |  3  | yes
 3 |   3   |  4  | 
 4 |   4   |  5  | 
 5 |   5   |  6  | yes


But using your current schema you could try by using:

WITH x AS
(
  SELECT
      point,
      stop,
      LEAD(point) OVER (ORDER BY point) nxt,
      SUM(CASE WHEN stop = true THEN 1 ELSE 0 END) OVER (ORDER BY point) grp
  FROM
      tbl
  ORDER BY
      point
)
SELECT
    grp, ST_MakeLine(array_agg(ST_MakePoint(point, nxt::int))) lines
FROM
    x
WHERE
    nxt IS NOT NULL
GROUP BY
    grp
ORDER BY
    grp;


That basically returns an array of points like this:


grp | points                   
--: | :------------------------
  1 | {&quot;(1,2)&quot;,&quot;(2,3)&quot;}        
  2 | {&quot;(3,4)&quot;,&quot;(4,5)&quot;,&quot;(5,6)&quot;}


Then using ST_MakePoint and ST_MakeLine you can get:


grp | lines                                                                                                             
--: | :-----------------------------------------------------------------------------------------------------------------
  1 | 010200000002000000000000000000F03F000000000000004000000000000000400000000000000840                                
  2 | 010200000003000000000000000000084000000000000010400000000000001040000000000000144000000000000014400000000000001840


db&lt;>fiddle here