postgres: return null on undefined date and time values