title: POSTGRESQL,subquery in FROM must have an alias
body: <pre><code>CREATE OR REPLACE FUNCTION sp_insert_nike_mapping_code ( shopId bigint ) RETURNS VOID AS $body$
  BEGIN
  
      insert into temp_t_so_sales_order_push(so_code,seq)
     SELECT so_code,nextval('s_t_so_sales_order_push_code') from (
     SELECT so_code from t_so_sales_order_push where sync_status = 0 group by so_code
     );
  
     update t_so_sales_order_push pu
     set code = (
         SELECT temp.seq from temp_t_so_sales_order_push temp
         where temp.so_code = pu.so_code and pu.shop_id = shopId and pu.sync_status = 0
     )
     where exists(
            SELECT 1 from temp_t_so_sales_order_push temp
            where temp.so_code = pu.so_code and pu.shop_id = shopId and pu.sync_status = 0
     );
  END
  $body$
  LANGUAGE PLPGSQL
  SECURITY DEFINER
  ;
  </code></pre>
  
  <p>when I executed the above code,got the syntax error: subquery in FROM must have an alias.
  [Err] ERROR:  subquery in FROM must have an alias
  LINE 5: ...ELECT so_code,nextval('s_t_so_sales_order_push_code') from (
                                                                        ^
  HINT:  For example, FROM (SELECT ...) [AS] foo.</p>
  
  <p>Does anyone help me?</p>