title: Different behaviour in "order by" clause: Oracle vs. PostgreSQL
body: <p>I have the following table (created and populated them in Oracle and PostgreSQL):</p>
  
  <pre><code>&gt; create table foo (a varchar(10));
  </code></pre>
  
  <p>I populated them with values, and <code>order by</code> clause is behaving differently in PostgreSQL and Oracle (I don't think versions are relevant to this question):</p>
  
  <p>Oracle:</p>
  
  <pre><code>&gt; select a, length(a) from foo order by a;
  A       LENGTH(A)
  ---------- ----------
  .1          2
  01          2
  1           1
  1#0         3
  1#1         3
  1.0         3
  1.1         3
  10          2
  11          2
  
  9 rows selected.
  </code></pre>
  
  <p>I get what I expect. <code>.1</code> before <code>01</code>, since <code>.</code> is before <code>0</code> in ascii table.</p>
  
  <p>However, in PostgreSQL I have:</p>
  
  <pre><code>=&gt; select a, length(a) from foo order by a;
    a  | length 
  -----+--------
   01  |      2
   1   |      1
   .1  |      2
   10  |      2
   1.0 |      3
   1#0 |      3
   11  |      2
   1.1 |      3
   1#1 |      3
  (9 rows)
  </code></pre>
  
  <p>Why the difference? I know it probably has something to do with collate order or similar, but I would like some pointers on where to read more about it.</p>
  
  <p>UPDATE: collate info on the PostgreSQL database:</p>
  
  <pre><code>Encoding: UTF8
  Collante: en_US.UTF-8
  Ctype: en_US.UTF-8 | 
  </code></pre>
  
  <p>Thanks!</p>