title: order a table in postgresql based in a specific string field with format number/year
body: <p>I have internal communication table that has a field called ci_num and it's format is number/year. ex: 23/2020.</p>
  
  <p>I would like to order my table based in this field. I've searched but didn't find how to create a function to order this way. </p>
  
  <p>In java, I do this using a custom sorting function. I've tried to do the same thing in postgres but without success.</p>
  
  <p>using ascending:</p>
  
  <pre><code>select * from cis c order by ci_num asc
  </code></pre>
  
  <p>result:</p>
  
  <pre>
  ci_id|ci_num |tipo_cod|status_cod|setor_cod|usuario_id
  -----|-------|--------|----------|---------|----------
     10|10/2020|GE      |EC        |NUTEC    |         1
     11|11/2020|CO      |DB        |NUCAD    |         4
      1|1/2020 |CO      |DE        |NUCAD    |         1
     12|12/2020|CO      |NG        |NUTEC    |         4
     13|13/2020|CO      |AT        |NUOPE    |         4
     14|14/2020|CO      |NG        |NUTEC    |         4
     15|15/2020|GE      |DE        |NUOPE    |         4
     16|16/2020|CO      |NG        |NUTEC    |         4
     17|17/2020|CO      |CA        |NUTEC    |         4
  </pre>
  
  <p>using descending gets worse:</p>
  
  <pre><code>select * from cis c order by ci_num desc
  </code></pre>
  
  <pre>
  ci_id|ci_num |tipo_cod|status_cod|setor_cod|usuario_id
  -----|-------|--------|----------|---------|----------
      9|9/2020 |IN      |AT        |NUOPE    |         4
      8|8/2020 |CO      |NG        |NUTEC    |         4
      7|7/2020 |GE      |CA        |NUTEC    |         4
      6|6/2020 |HE      |CR        |NUCAD    |         1
     54|54/2020|GE      |EA        |NUTEC    |         4
     53|53/2020|GE      |EA        |NUOPE    |         1
     52|52/2020|GE      |EA        |NUOPE    |         1
  </pre>
  
  <p>Thanks for your help!</p>