title: Syntax error in redshift sql query with subqueries
body: <p>I'm quite new in SQL in general and haven't deal with redshift before. I'm trying to make one query, which works perfectly in postgresql. But I get syntax error in redshift. The query is:</p>
  
  <pre><code>SELECT 
      test.table_1.user_id as user_id,
      test.table_1.timestamp as start_session,
      test.table_1.step_3 :: timestamp +  interval '1 hour' as end_session,
      test.table_1.step_3 :: timestamp +  interval '1 hour' - test.table_1.timestamp :: timestamp as session_duration
  
  FROM (SELECT *,
      min(case when page = 'second_page' then timestamp end) OVER (partition by user_id order by timestamp desc rows between unbounded preceding and unbounded following) as step_2,
      min(case when page = 'third_page' then timestamp end) OVER (partition by user_id order by timestamp desc rows between unbounded preceding and unbounded following) as step_3
      FROM test.table_1) test.table_1
  
  WHERE 
      test.table_1.page = 'first_page' AND
      step_2 &gt; test.table_1.timestamp AND
      step_3 &gt; step_2 AND
      step_3 :: timestamp - step_2 :: timestamp &lt; '1 hour' AND
      step_2 :: timestamp - test.table_1.timestamp :: timestamp &lt; '1 hour'
  ORDER BY
      user_id,start_session
  </code></pre>
  
  <p>The error is <code>Error running query: syntax error at or near "." LINE 11: FROM test.vimbox_pages) test.vimbox_pages ^</code>  in line  <code>FROM test.table_1) test.table_1</code>
  I don't understand what's wrong there. 
  By this query I'm trying to get session list of users actions during reading pages in some order. 
  Will be thankful for any help!</p>