- 04 4月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
I've experienced this issue in our app, some hints only works on Top level query (e.g. `MAX_EXECUTION_TIME`).
-
- 26 2月, 2019 1 次提交
-
-
由 jvillarejo 提交于
When using `select` with `'DISTINCT( ... )'` if you use method `size` on a non loaded relation it overrides the column selected by passing `:all` so it returns different value than count. This fixes #35214
-
- 13 2月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
Currently custom attributes are always qualified by the table name in the generated SQL wrongly even if the table doesn't have the named column, it would cause an invalid SQL error. Custom attributes should only be qualified if the table has the same named column.
-
- 18 1月, 2019 2 次提交
-
-
由 Rafael Mendonça França 提交于
-
由 Rafael Mendonça França 提交于
-
- 04 1月, 2019 1 次提交
-
-
由 Alberto Almagro 提交于
Since Ruby 2.6.0 NilClass#to_d is returning `BigDecimal` 0.0, this breaks `average` compatibility with prior Ruby versions. This patch makes `average` return `nil` in all Ruby versions when there are no rows.
-
- 02 1月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
This reverts 27c6c071 since `arel_attr.to_s` is not right way to avoid the type error. That to_s returns `"#<struct Arel::Attributes::Attribute ...>"`, there is no reason to match the regex to the inspect form. And also, the regex path is not covered by our test cases. I've tweaked the regex for redundant part and added assertions for the regex path.
-
- 27 8月, 2018 1 次提交
-
-
由 Kevin Deisz 提交于
-
- 25 8月, 2018 1 次提交
-
-
由 Kevin Deisz 提交于
-
- 29 7月, 2018 2 次提交
-
-
由 Bart de Water 提交于
-
由 Bart de Water 提交于
In cases where the MatchData object is not used, this provides a speed-up: https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
-
- 26 2月, 2018 1 次提交
-
-
由 Max Schwenk 提交于
-
- 10 2月, 2018 2 次提交
-
-
由 yuuji.yaginuma 提交于
-
由 David Heinemeier Hansson 提交于
* Add Relation#pick as short-hand for single-value plucks
-
- 29 1月, 2018 1 次提交
-
-
由 Daniel Colson 提交于
With #31615 `type_for_attribute` accepts either a symbol as well as a string. `has_attribute?` and `attribute_alias` also accept either. Since these methods call `to_s` on the argument, we no longer need to do that at the call site.
-
- 25 1月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
This is a regression caused by 6beb4de7. In PostgreSQL, ORDER BY expressions must appear in SELECT list when using DISTINCT. When using `count(:all)` with eager loading, Active Record enforces DISTINCT to count the driving table records only. 6beb4de7 was caused the regression because `count(:all)` with DISTINCT path no longer removes ORDER BY. We need to ignore ORDER BY when DISTINCT is enforced, otherwise not always generated valid SQL for PostgreSQL. Fixes #31783.
-
- 20 12月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Currently `count(:all)` with `distinct` doesn't work correctly because SELECT list is always replaced to `*` or primary key in that case even if having custom SELECT list. And also, PostgreSQL has a limitation that ORDER BY expressions must appear in select list for SELECT DISTINCT. Therefore, we should not replace custom SELECT list when using `count(:all)` with `distinct`. Closes #31277.
-
- 09 11月, 2017 4 次提交
- 06 11月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Fixes #30315.
-
- 14 10月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
This is the fix for the regression of #29848. In #29848, I've kept existing select list in the subquery for the count if ORDER BY is given. But it had accidentally affect to GROUP BY queries also. It should keep the previous behavior in that case. Fixes #30886.
-
- 09 10月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
I don't think this is a good abstraction because the internal method is used only if the relation need to be applied join dependency.
-
- 23 9月, 2017 1 次提交
-
-
由 Ken Collins 提交于
-
- 15 8月, 2017 1 次提交
-
-
由 Aaron Wortham 提交于
When using a has_many through relation and then summing an attribute the distinct was not being used. This will ensure that when summing an attribute, the number is only used once when distinct has been used.
-
- 24 7月, 2017 1 次提交
-
-
由 Sean Griffin 提交于
A common source of bugs and code bloat within Active Record has been the need for us to maintain the list of bind values separately from the AST they're associated with. This makes any sort of AST manipulation incredibly difficult, as any time we want to potentially insert or remove an AST node, we need to traverse the entire tree to find where the associated bind parameters are. With this change, the bind parameters now live on the AST directly. Active Record does not need to know or care about them until the final AST traversal for SQL construction. Rather than returning just the SQL, the Arel collector will now return both the SQL and the bind parameters. At this point the connection adapter will have all the values that it had before. A bit of this code is janky and something I'd like to refactor later. In particular, I don't like how we're handling associations in the predicate builder, the special casing of `StatementCache::Substitute` in `QueryAttribute`, or generally how we're handling bind value replacement in the statement cache when prepared statements are disabled. This also mostly reverts #26378, as it moved all the code into a location that I wanted to delete. /cc @metaskills @yahonda, this change will affect the adapters Fixes #29766. Fixes #29804. Fixes #26541. Close #28539. Close #24769. Close #26468. Close #26202. There are probably other issues/PRs that can be closed because of this commit, but that's all I could find on the first few pages.
-
- 22 7月, 2017 2 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Since #26972, `ORDER BY` is kept if `LIMIT` is presented for performance. But in most SQL servers (e.g. PostgreSQL, SQL Server, etc), `ORDER BY` expressions must appear in select list for `SELECT DISTINCT`. We should not replace existing select list in that case.
-
- 20 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 06 7月, 2017 1 次提交
-
-
由 Eugene Kenny 提交于
The `find_each`, `find_in_batches` and `in_batches` APIs usually operate on large numbers of records, where it's preferable not to load them all into memory at once. If the query cache is enabled, it will hold onto the query results until the end of the execution context (request/job), which means the memory used is still proportional to the total number of records. These queries are typically not repeated, so the query cache isn't desirable here.
-
- 02 7月, 2017 1 次提交
-
-
由 Matthew Draper 提交于
This reverts commit 3420a145, reversing changes made to afb66a5a.
-
- 01 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 29 6月, 2017 2 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
The delegation was needed since passing `relation` with `relation.bound_attributes`. It should use `relation.arel` in that case.
-
- 29 5月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Deprecate passing arguments and block at the same time to `count` and `sum` in `ActiveRecord::Calculations` `select`, `count`, and `sum` in `Relation` are also `Enumerable` method that can be passed block. `select` with block already doesn't take arguments since 4fc3366d. This is follow up of that.
-
- 05 5月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
The argument of `Arel::SelectManager.new` is `table`, not `engine`. https://github.com/rails/arel/blob/v8.0.0/lib/arel/select_manager.rb#L10
-
- 10 3月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Follow up of #24203. Since b644964b `ActiveRecord::Relation` includes `Enumerable` so it is enough to call `super` simply.
-
- 26 2月, 2017 2 次提交
-
-
由 Eugene Kenny 提交于
When a grouped calculation contains a having clause that references a selected value, we need to include that selected value in the query. Postgres doesn't support referencing a selected value in a having clause, but other databases do; we can skip the test on the pg adapter but run it for the others. This was fixed before in 9a298a16, but the test coverage was lost in 5a05207d. The fix regressed in 6311975f and was removed in 97d46c17.
-
由 Ryuta Kamizono 提交于
`select_values` is a local variable defined at previous line. `select_values += select_values` is totally useless.
-