          sql = '(%s)::date' % field_name
          return sql, params
  
      def datetime_cast_time_sql(self, field_name, tzname):
          field_name, params = self._convert_field_to_tz(field_name, tzname)
          sql = '(%s)::time' % field_name
          return sql, params
  
      def datetime_extract_sql(self, lookup_type, field_name, tzname):
          field_name, params = self._convert_field_to_tz(field_name, tzname)
          sql = self.date_extract_sql(lookup_type, field_name)
          return sql, params
 
</s> remove         field_name, params = self._convert_field_to_tz(field_name, tzname)
        sql = '(%s)::date' % field_name
        return sql, params
 </s> add         field_name = self._convert_field_to_tz(field_name, tzname)
        return '(%s)::date' % field_name </s> remove         field_name, params = self._convert_field_to_tz(field_name, tzname)
        sql = self.date_extract_sql(lookup_type, field_name)
        return sql, params
 </s> add         field_name = self._convert_field_to_tz(field_name, tzname)
        return self.date_extract_sql(lookup_type, field_name) </s> remove         field_name, params = self._convert_field_to_tz(field_name, tzname)
        sql = "TIME(%s)" % field_name
        return sql, params
 </s> add         field_name = self._convert_field_to_tz(field_name, tzname)
        return "TIME(%s)" % field_name </s> remove         field_name, params = self._convert_field_to_tz(field_name, tzname)
        sql = "DATE(%s)" % field_name
        return sql, params
 </s> add         field_name = self._convert_field_to_tz(field_name, tzname)
        return "DATE(%s)" % field_name </s> remove         field_name, params = self._convert_field_to_tz(field_name, tzname)
 </s> add         field_name = self._convert_field_to_tz(field_name, tzname)
        field_name = self._convert_field_to_tz(field_name, tzname)
        return '(%s)::time' % field_name
          sql = '(%s)::date' % field_name
          return sql, params
  
      def datetime_cast_time_sql(self, field_name, tzname):
        field_name = self._convert_field_to_tz(field_name, tzname)
        return '(%s)::time' % field_name
        field_name = self._convert_field_to_tz(field_name, tzname)
        return '(%s)::time' % field_name
        field_name = self._convert_field_to_tz(field_name, tzname)
        return '(%s)::time' % field_name
  
      def datetime_extract_sql(self, lookup_type, field_name, tzname):
          field_name, params = self._convert_field_to_tz(field_name, tzname)
          sql = self.date_extract_sql(lookup_type, field_name)
          return sql, params
keep keep keep keep replace replace replace keep keep keep keep keep
 Fixed #27802 -- Unified return value of db backend datetime SQL methods. 
django/db/backends/postgresql/operations.py