title: How to make ORDER SIBLINGS BY?
body: <p>I'm using PostgreSQL 9.1.6 and trying to build recursive SQL.<br>
  I want to sort like <code>ORDER SIBLINGS BY</code> in SQL-Server does it.</p>
  
  <p><sub>Editor's note: This is probably supposed to refer to <strong><em>Oracle</em></strong>, <a href="https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_10002.htm#i2171079" rel="nofollow noreferrer">where <code>ORDER SIBLINGS BY</code> actually exists</a>.</sub></p>
  
  <p>Test table:</p>
  
  <pre><code>create table RECURSIVE_TEST(
    EMP_ID int,
    MANAGER_ID int,
    EMP_NAME varchar(30)
  );
  
  insert into recursive_test values
  (1  ,0 ,'MANAGER1'),
  (2  ,0 ,'MANAGER2'),
  (3  ,0 ,'MANAGER3'),
  (4  ,0 ,'MANAGER4'),
  (5  ,1 ,'emp1'),
  (6  ,3 ,'emp2'),
  (7  ,4 ,'emp3'),
  (8  ,2 ,'emp4'),
  (9  ,2 ,'emp5'),
  (10 ,3 ,'emp6'),
  (11 ,4 ,'emp7'),
  (12 ,3 ,'emp8'),
  (13 ,4 ,'emp9'),
  (14 ,2 ,'emp10'),
  (15 ,2 ,'emp11'),
  (16 ,1 ,'emp12');
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>WITH RECURSIVE T AS
  (
      SELECT A.EMP_ID
               ,A.MANAGER_ID
               ,A.EMP_NAME
        FROM RECURSIVE_TEST A
      WHERE MANAGER_ID = 0
      UNION ALL
      SELECT A.EMP_ID
               ,A.MANAGER_ID
               ,A.EMP_NAME
        FROM RECURSIVE_TEST A, T
      WHERE A.MANAGER_ID = T.EMP_ID
  )
  SELECT * FROM T;
  </code></pre>
  
  <p>Result:</p>
  
  
  
  <pre class="lang-none prettyprint-override"><code> emp_id | manager_id | emp_name 
  --------+------------+----------
        1 |          0 | MANAGER1
        2 |          0 | MANAGER2
        3 |          0 | MANAGER3
        4 |          0 | MANAGER4
        5 |          1 | emp1
        6 |          3 | emp2
        7 |          4 | emp3
        8 |          2 | emp4
        9 |          2 | emp5
       10 |          3 | emp6
       11 |          4 | emp7
       12 |          3 | emp8
       13 |          4 | emp9
       14 |          2 | emp10
       15 |          2 | emp11
       16 |          1 | emp12
  </code></pre>
  
  <p>I want to sort the result-set up there like below.</p>
  
  <pre class="lang-none prettyprint-override"><code> emp_id | manager_id | emp_name 
  --------+------------+----------
        1 |          0 | MANAGER1
        5 |          1 | emp1
       16 |          1 | emp12      
        2 |          0 | MANAGER2
        8 |          2 | emp4
        9 |          2 | emp5
       14 |          2 | emp10
       15 |          2 | emp11      
        3 |          0 | MANAGER3
        6 |          3 | emp2
       10 |          3 | emp6
       12 |          3 | emp8     
        4 |          0 | MANAGER4
        7 |          4 | emp3
       11 |          4 | emp7
       13 |          4 | emp9
  </code></pre>
  
  <p>Any advice?</p>