Edit As per your comments, polygons may exist along the line. There is a number of ways of doing this query, but unless you know the maximum amount intersections that will happen having the output rows in the format that you have specified will be dificult. Here's a couple of options
-- One row per intersection
SELECT l.id line_id, p.id polygon_id
FROM Lines l
LEFT OUTER JOIN Polygons p ON ST_Intersects(p.Geom, ST_Buffer(l.Geom,0.05));
-- One row per line with an array of intersections ids
SELECT l.id line_id, array_agg(p.id) polygon_id
FROM Lines l
LEFT OUTER JOIN Polygons p ON ST_Intersects(p.Geom, ST_Buffer(l.Geom,0.05))
GROUP BY l.id;
-- Crosstab query
SELECT line_id,
MAX(CASE WHEN r = 1 THEN polygon_id END) polygon_id_1,
MAX(CASE WHEN r = 2 THEN polygon_id END) polygon_id_2,
MAX(CASE WHEN r = 3 THEN polygon_id END) polygon_id_3,
MAX(CASE WHEN r = 4 THEN polygon_id END) polygon_id_4,
MAX(CASE WHEN r = 5 THEN polygon_id END) polygon_id_5
-- ...
FROM (
SELECT l.id line_id, p.id polygon_id, ROW_NUMBER() OVER (PARTITION BY l.id ORDER BY p.id) r
FROM Lines l
LEFT OUTER JOIN Polygons p ON ST_Intersects(p.Geom, ST_Buffer(l.Geom,0.05))
) a
GROUP BY line_id;