          # Escape any params because trunc_sql will format the string.
          inner_sql = inner_sql.replace('%s', '%%s')
          if isinstance(self.output_field, DateTimeField):
              tzname = self.get_tzname()
              sql, params = connection.ops.datetime_trunc_sql(self.kind, inner_sql, tzname)
          elif isinstance(self.output_field, DateField):
              sql = connection.ops.date_trunc_sql(self.kind, inner_sql)
              params = []
          elif isinstance(self.output_field, TimeField):
              sql = connection.ops.time_trunc_sql(self.kind, inner_sql)
 
</s> remove             params = []
 </s> add  </s> remove             params = []
 </s> add  </s> remove             sql, tz_params = connection.ops.datetime_extract_sql(self.lookup_name, sql, tzname)
            params.extend(tz_params)
 </s> add             sql = connection.ops.datetime_extract_sql(self.lookup_name, sql, tzname) </s> remove         return sql, inner_params + params
 </s> add         return sql, inner_params </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)
            sql = connection.ops.datetime_trunc_sql(self.kind, inner_sql, tzname)
          # Escape any params because trunc_sql will format the string.
          inner_sql = inner_sql.replace('%s', '%%s')
          if isinstance(self.output_field, DateTimeField):
              tzname = self.get_tzname()
            sql = connection.ops.datetime_trunc_sql(self.kind, inner_sql, tzname)
          elif isinstance(self.output_field, DateField):
              sql = connection.ops.date_trunc_sql(self.kind, inner_sql)
              params = []
          elif isinstance(self.output_field, TimeField):
              sql = connection.ops.time_trunc_sql(self.kind, inner_sql)
keep keep keep keep replace keep keep keep keep keep
 Fixed #27802 -- Unified return value of db backend datetime SQL methods. 
django/db/models/functions/datetime.py