title: Delete records in PostgreSQL, older than X days, where X is a parameter
body: <p>I want to delete records older than a given (as a parameter to the function)  number of days.</p>
  
  <p>There are similar questions (e.g. <a href="https://stackoverflow.com/questions/17997990/sql-get-all-records-older-than-30-days">SQL Get all records older than 30 days</a>) which recommend to use interval '30 day' but how to make the 30 a parameter?</p>
  
  <p>I have a column with a timestamp and the delete would be done in a function that's in SQL rather than plpgsql</p>