| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
Currently the normalization only exists in `primary_key` shorthand. It
should be moved to `new_column_definition` to also affect to
`add_column` with primary key.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`change_column_{default,null,comment}` in mysql2 adapter are passing
`column.sql_type` as `type` to `change_column` to intend keeping
previous type. But `column_for` requires extra query, so use passing
`nil` to `type` explicitly in the internal for the purpose.
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \
| | | |
| | | | |
Add :comment option for add_column [ci skip]
|
| | | | |
|
|/ / /
| | |
| | |
| | |
| | |
| | | |
If collided named sequence already exists, newly created serial column
will generate alternative sequence name. Fix sequence name detection to
allow the alternative names.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Because `quoted_table_name` doesn't respect table alias. We should use
`arel_attribute` for that, so I added `column_name_from_arel_node` to
generate column name from an arel node.
|
| | |
| | |
| | |
| | | |
Fixes #30539.
|
| |/
|/|
| |
| |
| |
| |
| | |
Otherwise using reserved words as composite primary key names will be
failed as an invalid SQL.
Fixes #30518.
|
| |
| |
| |
| |
| |
| | |
type columns
Fixes #30496.
|
|\ \
| | |
| | | |
Clarify that bulk option is supported only by MySQL
|
| | |
| | |
| | |
| | | |
- Closes #30441
|
|/ / |
|
| | |
|
|\ \
| | |
| | | |
Refactor `SchemaDumper` to make it possible to adapter specific customization
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Currently `SchemaDumper` is only customizable for column options. But
3rd party connection adapters (oracle-enhanced etc) need to customizable
for table or index dumping also. To make it possible, I introduced
adapter specific `SchemaDumper` classes for that.
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Add TransactionTimeout for MySQL error code 1205
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| | |
`SET time zone 'value'` is an alias for `SET timezone TO 'value'`.
https://www.postgresql.org/docs/current/static/sql-set.html
So if `variables["timezone"]` is specified, it is enough to
`SET timezone` once.
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
This is only used for the internal `column_spec` and
`column_spec_for_primary_key`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
currently integer types extracts the `limit` from `sql_type`. But the
lookup key of type map is the `oid` in postgresql adapter. So in most
case `sql_type` is passed to `extract_limit` as `""` and `limit` is
extracted as `nil`.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L445
In mysql2 adapter, `limit` is registered correctly without extracting
from `sql_type`.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L678-L682
Postgresql adapter should also be registered correctly.
``` ruby
conn = ActiveRecord::Base.connection
conn.select_all("SELECT 1::smallint, 2::integer, 3::bigint").column_types.map do |name, type|
[name, type.limit]
end
```
Before:
``` ruby
# => [["int2", nil], ["int4", nil], ["int8", nil]]
```
After:
``` ruby
# => [["int2", 2], ["int4", 4], ["int8", 8]]
```
|
| |
| |
| |
| |
| |
| |
| |
| | |
(#29944)
Since 213796f, it was lost the ability that SQL with binds for `insert`,
`update`, and `delete` (like `select_all`). This restores the ability
because `insert`, `update`, and `delete` are public API, so it should
not be removed without deprecation.
|
| |
| |
| |
| | |
Because `to_sql` is public API. I introduced `to_sql_and_binds` internal
API to return SQL and binds.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
refs: https://github.com/rails/rails/pull/30161
```
$ echo "+@size+" | rdoc --pipe
<p>+@size+</p>
$ echo "<tt>@size</tt>" | rdoc --pipe
<p><code>@size</code></p>
```
[ci skip]
|
| |
| |
| |
| |
| |
| |
| | |
Otherwise `ConnectionPool#reap` may run before `@connections` has
initialized.
https://travis-ci.org/rails/rails/jobs/263037427#L888-L890
|
|\ \
| | |
| | | |
Add missed `require`
|
| | |
| | |
| | |
| | |
| | | |
`ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration`
depends on `Concurrent::Map`.
|
|/ / |
|
| | |
|
| |
| |
| |
| |
| | |
It seems that it accepts only HTTPS connections.
Ref: https://github.com/postgres/postgres/commit/7f77cbd996855a06fb742ea11adbe55c42b48fe2
|
| |
| |
| |
| | |
For less duplicated code.
|
| |
| |
| |
| |
| | |
The limit option is ignored by PostgreSQL and may be ignored by 3rd
party backends. Make this clear in the docs. Fixes #29922.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This also reverts the change to enable prepared statements by default on
MySQL (though I suspect we could enable them and it'd be great). This
change brings back a collector closer to the old `Bind` collector in
Arel. However, this one lives in AR, since this is an AR specific need.
Additionally, we only use it for statement caching, since the new
substitute collector in Arel is higher performance for most cases.
|
| |
| |
| |
| |
| |
| | |
There's an actual bug in 213796fb4936dce1da2f0c097a054e1af5c25c2c around
prepared statements being disabled. I'm looking into it, but in the mean
time this gets the build green so it doesn't block other PRs
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Use `TRUE` and `FALSE` boolean literals for MySQL
|
| | |
| | |
| | |
| | |
| | |
| | | |
Since #29699, abstract boolean serialization has been changed to use
`TRUE` and `FALSE` literals. MySQL also support the literals.
So we can use the abstract boolean serialization even for MySQL.
|
|\ \ \
| | | |
| | | | |
Make `type_map` to private because it is only used in the connection adapter
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | | |
`type_map` is an internal API and it is only used in the connection
adapter. And also, some type map initializer methods requires passed
`type_map`, but those instances already has `type_map` in itself.
So we don't need explicit passing `type_map` to the initializers.
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Context #24542.
Since 8ebe1f2, it has lost stripping date part for a time value. But I
confirmed it is still needed even if MariaDB 10.2.6 GA.
MariaDB 10.2.6, `prepared_statements: true`:
```
% ARCONN=mysql2 be ruby -w -Itest test/cases/time_precision_test.rb -n test_formatting_time_according_to_precision
Using mysql2
Run options: -n test_formatting_time_according_to_precision --seed 37614
F
Failure:
TimePrecisionTest#test_formatting_time_according_to_precision [test/cases/time_precision_test.rb:53]:
Failed assertion, no message given.
bin/rails test test/cases/time_precision_test.rb:46
Finished in 0.040279s, 24.8268 runs/s, 24.8268 assertions/s.
1 runs, 1 assertions, 1 failures, 0 errors, 0 skips
```
|
|\ \
| | |
| | |
| | |
| | | |
cswilliams/rescue_postgres_connection_errors_on_dealloc
Catch postgres connection errors when trying to dealloc
|
| | |
| | |
| | |
| | |
| | |
| | | |
connection_active? will sometimes return true when the connection is actually dead/disconnected (see #3392 for a discussion of why this is). When this happens, a query is run on the dead connection which causes various postgres connection errors to be raised. This fix catches any such errors and ignores them.
Closes #29760
|