title: How to extract year from interval in postgres
body: <p>I found out that the following line:</p>
  
  <pre><code>select extract(year from '2021-01-01'::timestamp - '2020-01-01');
  </code></pre>
  
  <p>returns 0.</p>
  
  <p>Even if we go a bit further:</p>
  
  <pre><code>select extract(year from '2021-01-01'::timestamp - '2010-01-01');
  </code></pre>
  
  <p>The result is still 0.</p>
  
  <p>I understand the rationale behind this. If we run a query to check the interval between consecutive New Years:</p>
  
  <pre><code>select '2021-01-01'::timestamp - '2020-01-01';
  </code></pre>
  
  <p>We're getting the following result:</p>
  
  <blockquote>
    <p>0 years 0 mons 366 days 0 hours 0 mins 0.00 secs</p>
  </blockquote>
  
  <p><code>1 year</code> wouldn't be precise enough - it can mean 365 or 366 days.</p>
  
  <p><strong>Question</strong>: Is there an elegant method to retrieve year count from interval being the difference between two timestamps? Something like the first query, where I would expect result as 1.</p>