Postgresql Datepart Function Sql Example Problems