| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Make internal methods to private
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
privileges (take 2)
Re-create https://github.com/rails/rails/pull/21233
eeac6151a5 was reverted (127509c071b4) because it breaks tests.
----------------
ref: 72c1557254
- We must use `authors` fixture with `author_addresses` because of its foreign key constraint.
- Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
|
|
|
|
|
|
| |
Because this comment is not document for `supports_ranges?`
ref: https://github.com/rails/rails/pull/27636#discussion_r107560081
|
|
|
|
|
| |
The old top level classes PGconn, PGresult and PGError were deprecated
since pg-0.13.0: https://github.com/ged/ruby-pg/blob/master/History.rdoc#v0130-2012-02-09-michael-granger-gedfaeriemudorg
|
|
|
|
|
|
|
|
|
| |
mylake/reduce-postgresql-adapter-memory-bloat"
This reverts commit 192db64452d148c7b51713979459e38407380dc6, reversing
changes made to 9893955363cf6358556ed3b36f4538d5b54e9d17.
We can't sacrifice correctness for performance.
|
|\
| |
| | |
500x memory reduction of 10k schemas for postgresql adapter
|
| |
| |
| |
| | |
bloat especially in multi-schema structure database
|
|\ \
| |/
|/| |
Extract `data_source_sql` to refactor data source statements
|
| | |
|
| |
| |
| |
| |
| | |
Actually `index_name_length` depend on `max_identifier_length`, not
always 63.
|
| |
| |
| |
| |
| |
| |
| | |
`supports_migrations?` was added at 4160b518 to determine if schema
statements (`create_table`, `drop_table`, etc) are implemented in the
adapter. But all tested databases has been supported migrations since
a4fc93c3 at least.
|
| |
| |
| |
| |
| |
| |
| | |
`valid_type?` should return true if a type exists in
`native_database_types` at least.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/schema_dumper.rb#L136
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This ensures multiple threads inside a transactional test to see consistent
database state.
When a system test starts Puma spins up one thread and Capybara spins up
another thread. Because of this when tests are run the database cannot
see what was inserted into the database on teardown. This is because
there are two threads using two different connections.
This change uses the statement cache to lock the threads to using a
single connection ID instead of each not being able to see each other.
This code only runs in the fixture setup and teardown so it does not
affect real production databases.
When a transaction is opened we set `lock_thread` to `Thread.current` so
we can keep track of which connection the thread is using. When we
rollback the transaction we unlock the thread and then there will be no
left-over data in the database because the transaction will roll back
the correct connections.
[ Eileen M. Uchitelle, Matthew Draper ]
|
|
|
|
| |
knowledge about an index type
|
|
|
|
| |
Closes #27980
|
|
|
|
| |
Closes #27979
|
|
|
|
|
|
|
|
|
|
|
|
| |
`supports_primary_key?` was added to determine if `primary_key` is
implemented in the adapter in f060221. But we already use `primary_key`
without `supports_primary_key?` (207f266, 5f3cf42) and using
`supports_primary_key?` has been removed in #1318. This means that
`supports_primary_key?` is no longer used in the internal and Active
Record doesn't work without `primary_key` is implemented (all adapters
must implement `primary_key`).
Closes #27977
|
|
|
|
|
|
| |
Column options are passed as an hash args then used as `options` hash in
`add_column_options!`. Converting args to attributes is inconvinient for
using options as an hash.
|
|\
| |
| | |
Freeze default empty string for sql_type in get_oid_type
|
| |
| |
| |
| | |
One empty string allocation per column per row.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
column_definitions() needs to fetch the collation for every column, if
present. Previously, it did so using a correlated subquery - a subquery
that references results from the outer scope.
This patch updates the query to remove the subquery in favor of a
simpler and more efficient JOIN clause.
Running the two queries through EXPLAIN against Postgres additionally
shows that the original form with a correlated subquery requires a
Nested Loop Left Join, while the new form with a simple JOIN can use a
more efficient Merge Left Join.
|
|
|
|
|
|
|
|
|
|
| |
mtsmfm/disable-referential-integrity-without-superuser-privileges"
This reverts commit eeac6151a55cb7d5f799e1ae33aa64a839cbc3aa, reversing
changes made to 5c40239d3104543e70508360d27584a3e4dc5baf.
Reason: Broke the isolated tests.
https://travis-ci.org/rails/rails/builds/188721346
|
|\
| |
| |
| |
| | |
mtsmfm/disable-referential-integrity-without-superuser-privileges
Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser privileges
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
privileges
ref: 72c1557254
- We must use `authors` fixture with `author_addresses` because of its foreign key constraint.
- Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
|
| |
| |
| |
| |
| |
| | |
Some methods were added to public API in
5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of
the public API.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Raise `ActiveRecord::RangeError` when values that executed are out of range.
|
| |
| |
| |
| |
| | |
Raise `ActiveRecord::NotNullViolation` when a record cannot be inserted
or updated because it would violate a not null constraint.
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
PG's type map assumes that all Ruby floats are going to a field with an
OID of type float4 or float8, and generates text which is invalid syntax
for other types. Since the gem can handle floats properly without this
encoder (albeit slightly slower), we can continue to use that as we have
in prior versions of Rails.
Fixes #27246
|
|
|
|
|
|
|
|
|
|
| |
Since 9.4, PostgreSQL recommends using `pgcrypto`'s `gen_random_uuid()`
to generate version 4 UUIDs instead of the functions in the `uuid-ossp`
extension.
These changes uses the appropriate UUID function depending on the
underlying PostgreSQL server's version, while maintaining
`uuid_generate_v4()` in older migrations.
|
|
|
|
|
| |
A query may wait on a database-level lock, which could lead to a
deadlock between threads.
|
|
|
|
| |
If does not quote table name properly, invalid SQL is generated.
|
|\
| |
| |
| | |
Fix case insensitive check for text column in pg
|
| |
| |
| |
| | |
There's no 'text to text' casting in the cast table so the feature detection fails.
|
| | |
|
|/
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
|
|
|
|
|
|
|
|
|
|
| |
There are some minor changes to the point type as I had forgotten that
this will affect the behavior of `t.point` in migrations and the schema
dumper so we need to handle those as well.
I'll say this again so I can convince myself to come up with a better
structure... TYPES SHOULD NOT CARE ABOUT SCHEMA DUMPING AND WE NEED TO
BETTER SEPARATE THESE.
|
|
|
|
| |
For reduce instantiating `Type::Value`.
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
| |
|
| |
|
|\
| |
| |
| |
| |
| | |
Introduce new ActiveRecord transaction error classes
Closes #26018
|
| | |
|
| |
| |
| |
| |
| | |
Because `type_cast` against `binds` always requires
`attr.value_for_database` and this pattern appears frequently.
|
|/
|
|
| |
Address to https://github.com/rails/rails/commit/5a302bf553af0e6fedfc63299fc5cd6e79599ef3#commitcomment-18288388.
|
|
|
|
| |
or deadlocks
|