With line As (
select st_LineFromtext('LINESTRING (5999873.36 2107242.752, 6000402.75 2108533.721)  ') as geom
),
poly As (
  select ST_PolyFromText('POLYGON ((6000339.31 2107206.37, 6000737.32 2107567.51, 6000880.34 2107860.81, 6001267.89 2108088.5, 6001409.06 2108312.72, 6001375.45 2108361.66, 6001340.98 2108410.0, 6001305.68 2108457.74, 6001267.86 2108507.01, 6001200.56 2108575.58, 6001149.25 2108634.62, 6001132.76 2108661.69, 6001103.61 2108737.82, 6001087.76 2108775.75, 6001041.54 2108811.71, 6001032.24 2108815.24, 6001019.57 2108820.04, 6000991.16 2108832.11, 6000793.0 2108913.1, 6000056.9 2108810.13, 6000066.97 2108737.32, 6000068.14 2108732.88, 6000069.39 2108728.47, 6000070.72 2108724.08, 6000072.12 2108719.71, 6000073.6 2108715.37, 6000075.16 2108711.06, 6000076.79 2108706.77, 6000078.49 2108702.52, 6000080.27 2108698.29, 6000082.13 2108694.09, 6000084.05 2108689.93, 6000086.05 2108685.8, 6000088.12 2108681.71, 6000090.26 2108677.65, 6000092.47 2108673.64, 6000094.75 2108669.66, 6000097.1 2108665.72, 6000099.52 2108661.82, 6000102.01 2108657.97, 6000104.56 2108654.16, 6000107.18 2108650.39, 6000109.86 2108646.68, 6000112.61 2108643.0, 6000116.38 2108638.18, 6000118.19 2108636.0, 6000120.03 2108633.85, 6000121.92 2108631.73, 6000123.83 2108629.65, 6000125.79 2108627.6, 6000127.78 2108625.59, 6000129.8 2108623.61, 6000131.86 2108621.67, 6000133.95 2108619.76, 6000136.08 2108617.89, 6000138.23 2108616.06, 6000140.42 2108614.27, 6000142.64 2108612.51, 6000144.89 2108610.79, 6000147.17 2108609.12, 6000149.48 2108607.48, 6000152.32 2108605.55, 6000154.02 2108604.37, 6000155.75 2108603.22, 6000157.5 2108602.1, 6000159.26 2108601.02, 6000161.05 2108599.96, 6000162.85 2108598.94, 6000164.67 2108597.94, 6000166.51 2108596.98, 6000168.36 2108596.05, 6000170.23 2108595.16, 6000172.12 2108594.29, 6000174.02 2108593.46, 6000175.93 2108592.67, 6000177.86 2108591.9, 6000179.8 2108591.17, 6000181.75 2108590.48, 6000183.72 2108589.81, 6000185.69 2108589.19, 6000187.68 2108588.59, 6000189.68 2108588.04, 6000191.68 2108587.51, 6000193.7 2108587.03, 6000195.72 2108586.57, 6000197.75 2108586.16, 6000199.79 2108585.77, 6000201.84 2108585.43, 6000203.89 2108585.12, 6000205.94 2108584.84, 6000208.0 2108584.6, 6000210.07 2108584.4, 6000212.13 2108584.23, 6000214.2 2108584.1, 6000216.27 2108584.01, 6000218.35 2108583.95, 6000220.42 2108583.93, 6000222.49 2108583.94, 6000224.57 2108583.99, 6000226.64 2108584.08, 6000229.17 2108584.23, 6000230.61 2108584.27, 6000232.05 2108584.28, 6000233.49 2108584.27, 6000234.93 2108584.23, 6000236.37 2108584.17, 6000237.81 2108584.08, 6000239.24 2108583.96, 6000240.67 2108583.82, 6000242.11 2108583.66, 6000243.53 2108583.47, 6000244.96 2108583.26, 6000246.38 2108583.02, 6000247.79 2108582.75, 6000249.2 2108582.47, 6000250.61 2108582.15, 6000252.01 2108581.82, 6000253.41 2108581.46, 6000254.79 2108581.07, 6000256.17 2108580.66, 6000257.55 2108580.23, 6000258.91 2108579.77, 6000260.27 2108579.29, 6000261.62 2108578.78, 6000262.96 2108578.25, 6000264.29 2108577.7, 6000265.61 2108577.12, 6000266.92 2108576.53, 6000268.22 2108575.91, 6000269.51 2108575.26, 6000270.78 2108574.6, 6000272.05 2108573.91, 6000273.3 2108573.2, 6000274.54 2108572.47, 6000275.77 2108571.71, 6000276.98 2108570.94, 6000278.18 2108570.14, 6000279.37 2108569.33, 6000280.54 2108568.49, 6000281.7 2108567.63, 6000282.84 2108566.75, 6000283.97 2108565.86, 6000285.08 2108564.94, 6000286.17 2108564.0, 6000287.25 2108563.05, 6000288.31 2108562.08, 6000289.36 2108561.08, 6000290.38 2108560.07, 6000291.39 2108559.05, 6000292.38 2108558.0, 6000293.35 2108556.94, 6000294.31 2108555.86, 6000295.24 2108554.76, 6000296.16 2108553.65, 6000297.05 2108552.52, 6000297.93 2108551.38, 6000298.78 2108550.22, 6000299.62 2108549.05, 6000300.44 2108547.86, 6000301.23 2108546.66, 6000302.0 2108545.44, 6000302.75 2108544.22, 6000303.48 2108542.97, 6000304.19 2108541.72, 6000304.88 2108540.45, 6000305.54 2108539.18, 6000306.18 2108537.89, 6000306.8 2108536.59, 6000307.4 2108535.28, 6000307.97 2108533.95, 6000308.52 2108532.62, 6000309.05 2108531.28, 6000309.55 2108529.93, 6000310.03 2108528.58, 6000310.49 2108527.21, 6000310.92 2108525.84, 6000311.33 2108524.45, 6000311.71 2108523.07, 6000312.07 2108521.67, 6000312.41 2108520.27, 6000312.72 2108518.86, 6000313.14 2108516.73, 6000323.03 2108468.31, 6000252.44 2108418.62, 6000016.92 2108246.53, 5999870.87 2107775.35, 5999898.09 2107613.74, 5999946.93 2107496.02, 6000079.98 2107386.94, 6000097.73 2107299.5, 6000158.47 2107244.3, 6000242.76 2107214.5, 6000339.31 2107206.37))') as geom
)
select ST_Extend(l.geom,max(ST_distance(l.geom,t.geom)) + 10)
  from line as l,
       poly as p,
       (select (b.dp).geom as geom
          from (select ST_DumpPoints(a.geom) as dp from poly a) as b
       ) as t;
