title: PostgreSQL - Select the length of a numeric/decimal
body: <p>I have a list of prices with decimals.</p>
  
  <p>Example:
  0.513
  0.35135
  1.6583</p>
  
  <p>I'm trying to select the length of the decimal digits.
  Here's what I mean:
      0.513 | length=3
      0.35135 | length=5
      1.6583 | length=4</p>
  
  <p>I tried converting the numbers to text, but it doesn't seem to provide correct results:
      <code>select price, length(cast(price as text)) from table.prices</code></p>
  
  <p>I also tried this conversion method: 
      "length(price::text)"</p>
  
  <p>Any advice on how I can achieve this?</p>