aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate decimal columns being automatically treated as integersSean Griffin2014-05-271-0/+2
| | | | | | With ActiveRecord::Properties, we now have a reasonable path for users to continue to keep this behavior if they want it. This is an edge case that has added a lot of complexity to the code base.
* pg, add missing `:nodoc:` to adapter.Yves Senn2014-05-261-8/+8
|
* pg, remove unused code. Use `extract_schema_and_table` instead.Yves Senn2014-05-261-10/+0
|
* pg, extract schema definitions into separate file.Yves Senn2014-05-241-135/+3
| | | | | | | This mirrors the layout of abstract adapter and puts the definitions inside the `PostgreSQL` namespace (no longer under the adapter namespace). /cc @kares
* Remove special case in schema dumper for decimal without scaleSean Griffin2014-05-231-25/+15
|
* Move parsing of PG sql strings for defaults out of columnSean Griffin2014-05-231-0/+71
|
* Push limit to type objectsSean Griffin2014-05-221-2/+10
| | | | | Columns and injected types no longer have any conditionals based on the format of SQL type strings! Hooray!
* Push precision to type objectsSean Griffin2014-05-221-3/+15
|
* Push scale to type objectsSean Griffin2014-05-221-1/+5
| | | | | | Ideally types will be usable without having to specify a sql type string, so we should keep the information related to parsing them on the adapter or another object.
* Move `extract_precision` onto type objectsDan Croak and Sean Griffin2014-05-221-1/+1
|
* Merge pull request #15249 from sgrif/sg-register-types-in-adapterRafael Mendonça França2014-05-221-2/+49
|\ | | | | Use the generic type map for all PG type registrations
| * Use the generic type map for all PG type registrationsSean Griffin2014-05-221-2/+49
| | | | | | | | | | | | | | We're going to want all of the benefits of the type map object for registrations, including block registration and real aliasing. Moves type name registrations to the adapter, and aliases the OIDs to the named types
* | Allow additional arguments to be used during type map lookupsSean Griffin2014-05-221-2/+2
|/ | | | | | | | Determining things like precision and scale in postgresql will require the given blocks to take additional arguments besides the OID. - Adds the ability to handle additional arguments to `TypeMap` - Passes the column type to blocks when looking up PG types
* Use the generic type map for PostgreSQL OID registrationsSean Griffin2014-05-201-3/+20
|
* Have Postgres OID types inherit from general typesSean Griffin2014-05-201-1/+1
| | | | | Using general types where possible. Several more can go away once infinity gets figured out.
* Remove :timestamp column typeSean Griffin2014-05-191-1/+0
| | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`.
* Delegate `Column#type` to the injected type objectSean Griffin2014-05-191-9/+0
| | | | | | | | | | | | | | | | The decision to wrap type registrations in a proc was made for two reasons. 1. Some cases need to make an additional decision based on the type (e.g. a `Decimal` with a 0 scale) 2. Aliased types are automatically updated if they type they point to is updated later. If a user or another adapter decides to change the object used for `decimal` columns, `numeric`, and `number` will automatically point to the new type, without having to track what types are aliased explicitly. Everything else here should be pretty straightforward. PostgreSQL ranges had to change slightly, since the `simplified_type` method is gone.
* pg, re-introduce `PostgreSQL::Utils` to unify schema/table extraction.Yves Senn2014-05-191-0/+1
| | | | Partial revert of c0bfc3f412834ffe8327a15ae3a46602cc28e425
* pg, add missing nodocs for extracted modules.Yves Senn2014-05-191-4/+4
|
* :scissors:Rafael Mendonça França2014-05-141-2/+0
|
* PostgreSQLAdapter::Utils seems to be only used from a single spot - quite ↵kares2014-05-141-19/+0
| | | | redundant
* move PostgreSQL's DatabaseStatements out of the PostgreSQLAdapter name-spacekares2014-05-141-6/+1
|
* PostgreSQL's SchemaStatements seems a could candidate for re-use (with AR-JDBC)kares2014-05-141-2/+5
|
* introduce AR::ConnectionAdapters::PostgreSQL for sharing modules (with AR-JDBC)kares2014-05-141-6/+11
| | | ... 'shared' OID, ArrayParser and Cast helpers, also re-arranged Column's dependencies
* extract pg type map initialization process to `TypeMapInitializer`.Yves Senn2014-05-131-65/+3
|
* Merge branch 'master' into adequaterecordAaron Patterson2014-04-201-0/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (74 commits) [ci skip] builtin -> built-in Fix code indentation and improve formatting Grammar fix in Getting Started Guide Make URL escaping more consistent Optimize URI escaping Always escape string passed to url helper. Remove statement assuming coffee shop/public space wifi is inherently insecure Don't rely on Arel master in bug report template [ci skip] wrap methods in backticks [ci skip] "subhash" --> "sub-hash" multibyte_conformance.rb --> multibyte_conformance_test.rb Fix inconsistent behavior from String#first/#last `@destroyed` should always be set to `false` when an object is duped. remove warning `warning: ambiguous first argument; put parentheses or even spaces` :uglify -> :uglifier Regression test for irregular inflection on has_many Singularize association names before camelization Fix spelling and proper nouns Optimize select_value, select_values, select_rows and dry up checking whether to exec with cache for Postgresql adapter Include default rails protect_from_forgery with: :exception ... Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
| * Optimize select_value, select_values, select_rows and dry up checking ↵Kris Selden2014-04-171-0/+8
| | | | | | | | | | whether to exec with cache for Postgresql adapter Reduces creating unused objects, with the most dramatic reduction in select_values which used to map(&:first) an array of single element arrays.
* | Merge branch 'master' into adequaterecordAaron Patterson2014-04-141-3/+20
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (70 commits) [ci skip] Added link to ruby-lang.org installation. Use the index on hidden field `collection_check_boxes` respects `:index` option for the hidden filed name. docs, double meaning of `serialize` argument. Closes #14284. Just call read_attribute, no need to use `send`. - Fix lingering reference to `:text` instead of the newer `:plain` - Section references `form_tag` instead of the `form_for` used in the example again, read_attribute is public, so just call it read_attribute is public, so we should just call it Disable assest cache store in docs [ci skip] Make counter cache decrementation on destroy idempotent Write the failing test case for concurrent counter cache [ci skip] Use plain underscore instead of "\_". Update documentation to use Rails.application instead Add a changelog entry for #14546 [ci skip] Move tests for deep_dup and duplicable to object directory Missing 'are' in note - [ci skip] CollectionHelpers now accepts a readonly option Fix a few typos [ci skip] Bundle tzinfo-data on :x64_mingw (64-bit Ruby on Windows). don't bother with an offset if the offset is zero ...
| * PostgreSQL, warn once per connection per missing OID. Closes #14275.Yves Senn2014-04-111-2/+2
| | | | | | | | [Yves Senn & Matthew Draper]
| * PostgreSQL, adapter automatically reloads it's type map. Closes #14678.Yves Senn2014-04-111-3/+20
| | | | | | | | [Yves Senn & Matthew Draper]
* | remove the bind visitor since the collector handles substituting bind valuesAaron Patterson2014-04-091-6/+2
|/
* PostgreSQL and SQLite, remove varchar limit. [Vladimir Sazhin & Toms Mikoss ↵Yves Senn2014-04-041-1/+1
| | | | | | | | | | | | | | | | & Yves Senn] There is no reason for the PG adapter to have a default limit of 255 on :string columns. See this snippet from the PG docs: Tip: There is no performance difference among these three types, apart from increased storage space when using the blank-padded type, and a few extra CPU cycles to check the length when storing into a length-constrained column. While character(n) has performance advantages in some other database systems, there is no such advantage in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs. In most situations text or character varying should be used instead.
* PostgreSQL, Support for materialized views. [Dave Lee & Yves Senn]Dave Lee2014-04-021-0/+4
| | | | | Expand the query used in #table_exists? to include materialized views in the kinds of relations it searches.
* Clarify 'database does not exist' message and implementation.Jeremy Kemper2014-04-011-2/+2
| | | | | | | | | | | * Clarify what the situation is and what to do. * Advise loading schema using `rake db:setup` instead of migrating. * Use a rescue in the initializer rather than extending the error message in-place. * Preserve the original backtrace of other errors by using `raise` rather than raising again with `raise error`. References 0ec45cd15d0a2f5aebc75e23d841b6c12f3ba763
* fix, adjust OID query without range support to include required fields.Yves Senn2014-04-011-3/+4
| | | | | This is a follow-up fix to f7a6b115fea9f675190a79b701c7034214678f19 and 06082f66d541e581110406bbac3bc395bace3f86
* refactor, use `typtype` instead of `typinput` to segment PG types.Yves Senn2014-04-011-3/+3
|
* PostgreSQL, register custom domains. Closes #14305.Yves Senn2014-04-011-1/+11
| | | | | | | This patch registers custom domains in our OID-type_map. They will behave exactly as the type specified by `pg_type.typbasetype`. /cc @matthewd
* refactor, put `PostgreSQLColumn` into `column.rb`.Yves Senn2014-03-311-218/+1
| | | | | We have `connection_adapters/column.rb` so it's easier to remember that the column in in a separate file.
* Reap connections based on owning-thread deathMatthew Draper2014-03-181-4/+0
| | | | | | | | | | | | | | | | .. not a general timeout. Now, if a thread checks out a connection then dies, we can immediately recover that connection and re-use it. This should alleviate the pool exhaustion discussed in #12867. More importantly, it entirely avoids the potential issues of the reaper attempting to check whether connections are still active: as long as the owning thread is alive, the connection is its business alone. As a no-op reap is now trivial (only entails checking a thread status per connection), we can also perform one in-line any time we decide to sleep for a connection.
* Teach PostgreSQLAdapter#reset! to actually resetMatthew Draper2014-03-181-1/+6
| | | | It wasn't doing anything beyond clearing the statement cache.
* `change_table` supports `citext`. Follow up to #12523.Yves Senn2014-03-111-0/+4
|
* register OID for PostgreSQL citex datatype [Troy Kruthoff & Lachlan Sylvester]lsylvester2014-03-111-1/+8
| | | | citext makes it possible to use AR Hash finders for case-insensitive matching as sql UPPER/LOWER functions are not needed.
* Add Enum type to postgresql adapter's oids to prevent unknown OID warnings.Dieter Komendera2014-03-041-0/+6
|
* Fix warnings due to:Vipul A M2014-03-031-1/+1
| | | | | - unused variable in PG Adapter. - Ambiguous argument warning from range_test for use - to + Infinity range without brackets.
* dynamically define PostgreSQL OID range types.Yves Senn2014-02-231-5/+23
| | | | | | | | This gets AR working with custom defined range types. It also removes the need for subtype specific branches in `OID::Range`. This expands the interface of all `OID` types with the `infinity` method. It's responsible to provide a value for positive and negative infinity.
* Reaper has access to threadsafe active? callKevin Casey2014-02-081-1/+6
|
* Fix regression on `.select_*` methods.Arthur Neves2014-01-301-8/+0
| | | | | | | | | | | | | | | | | | This was a common pattern: ``` query = author.posts.select(:title) connection.select_one(query) ``` However `.select` returns a ActiveRecord::AssociationRelation, which has the bind information, so we can use that to get the right sql query. Also fix select_rows on postgress and sqlite3 that were not using the binds [fixes #7538] [fixes #12017] [related #13731] [related #12056]
* fix exception translationAaron Patterson2014-01-171-1/+1
|
* translate exceptions on prepared statement failureAaron Patterson2014-01-171-1/+5
|
* Make change_table use object of current database adapterNishant Modak2014-01-071-5/+5
| | | | | | | | | - Earlier, change_table was creating database-agnostic object. - After this change, it will create correct object based on current database adapter. - This will ensure that create_table and change_table will get same objects. - This makes update_table_definition method public and nodoc. - Fixes #13577 and #13503