aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* PostgreSQL, Support for materialized views. [Dave Lee & Yves Senn]Dave Lee2014-04-021-4/+1
| | | | | Expand the query used in #table_exists? to include materialized views in the kinds of relations it searches.
* PostgreSQL determine `Column#type` through corresponding OID. #7814Yves Senn2014-04-012-101/+91
| | | | | | | | | | | | | I ran the whole test suite and compared the old to the new types. Following is the list of types that did change with this patch: ``` DIFFERENT TYPE FOR mood: NEW: enum, BEFORE: DIFFERENT TYPE FOR floatrange: NEW: floatrange, BEFORE: float ``` The `floatrange` is a custom type. The old type `float` was simply a coincidence form the name `floatrange` and our type-guessing.
* refactor, put `PostgreSQLColumn` into `column.rb`.Yves Senn2014-03-311-0/+221
| | | | | We have `connection_adapters/column.rb` so it's easier to remember that the column in in a separate file.
* Postgres schema: Constrain sequence search classidJosh Williams2014-03-201-0/+1
| | | | | | | | | | | The pk_an_sequence_for query previously joined against pg_class's oid for rows in pg_depend, but pg_depend's objid may point to other system tables, such as pg_attrdef. If a row in one of those other tables coincidentally has the same oid as an (unrelated) sequence, that sequence name may be returned instead of the real one. This ensures that only the pg_depend entries pointing to pg_class are considered.
* register OID for PostgreSQL citex datatype [Troy Kruthoff & Lachlan Sylvester]lsylvester2014-03-111-0/+1
| | | | 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
|
* Coerce strings when reading attributes.Yves Senn2014-02-231-5/+13
|
* deprecate support for pg ranges with excluding beginnings.Yves Senn2014-02-231-0/+12
| | | | | | | | | | | | | | | The Ruby Range object does not support excluding beginnings. We currently support excluding beginnings for some subtypes using manually by incrementing them (now using the `#succ` method). This is approach is flawed as it's not equal to an excluding beginning. This commit deprecates the current support for excluding beginnings. It also raises an `ArgumentError` for subtypes that do not implement the `succ` method. This is a temporary solution to get rid of the broken state. We might still add complete support for excluding beginnings afterwards. (Probably with a new `PGRange` object, which acts like a `Range` but has excluding beginnings.
* dynamically define PostgreSQL OID range types.Yves Senn2014-02-231-36/+14
| | | | | | | | 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.
* Merge branch '4-1-0-beta2'Rafael Mendonça França2014-02-181-1/+5
|\ | | | | | | | | | | Conflicts: actionview/CHANGELOG.md activerecord/CHANGELOG.md
| * Correctly escape PostgreSQL arrays.Aaron Patterson2014-02-181-1/+5
| | | | | | | | | | | | Thanks Godfrey Chan for reporting this! Fixes: CVE-2014-0080
* | Resolve encoding issues with arrays of hstore (bug 11135).Josh Goodall2014-02-172-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We didn't have enough encoding for the wire protocol to store an array of hstore types. So, further encode any hstore that is an array member. Whilst we're here, ensure it's an HashWithIndifferentAccess being returned, to be consistent with other serialized forms, and add testing for arrays of hstore. So now the following migration: enable_extension "hstore" create_table :servers do |t| t.string :name t.hstore :interfaces, array: true end produces a model that can used like this, to store an array of hashes: server = Server.create(name: "server01", interfaces: [ { name: "bge0", ipv4: "192.0.2.2", state: "up" }, { name: "de0", state: "disabled", by: "misha" }, { name: "fe0", state: "up" }, ]) More at http://inopinatus.org/2013/07/12/using-arrays-of-hstore-with-rails-4/
* | Merge pull request #13688 from jbaudanza/psql-index-existsRafael Mendonça França2014-02-011-0/+13
|\ \ | | | | | | | | | | | | | | | | | | PostgreSQL implementation of SchemaStatements#index_name_exists? Conflicts: activerecord/CHANGELOG.md
| * | psql implementation of #index_name_exists?Jonathan Baudanza2014-01-161-0/+13
| | |
* | | Fixes issue with parsing whitespace content back from database - fixes #13907Mauricio Linhares2014-02-011-2/+3
| | |
* | | Fix regression on `.select_*` methods.Arthur Neves2014-01-301-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 quoting non-stringsDamien Mathieu2013-12-221-1/+1
|/ | | | Closes #13444
* Use the right type_mapRafael Mendonça França2013-12-052-5/+3
|
* make the type_map per connection. fixes #13182Aaron Patterson2013-12-041-1/+1
|
* Typo fixes [ci skip]Akshay Vishnoi2013-11-301-1/+1
|
* Drop unused param `should_be_quoted` to `PostgreSQLColumn#array_to_string`Vipul A M2013-11-171-1/+1
|
* Change array check for better aesthetics / reading the codeCarlos Antonio da Silva2013-11-091-1/+1
|
* Document the bind returnRafael Mendonça França2013-11-091-0/+3
|
* Avoid shot circuit return.Rafael Mendonça França2013-11-091-8/+20
| | | | This will make the conditional and to code clear
* Merge pull request #10664 from aderyabin/docpatchYves Senn2013-10-291-1/+1
|\ | | | | Fix doc in Postgres database creation [ci skip]
| * Fix doc in Postgres database creationAndrey Deryabin2013-06-251-1/+1
| |
* | cast json values on write to be consistent with reading from the db.Severin Schoepke2013-10-251-0/+4
| | | | | | | | See also commit 5ac2341fab689344991b2a4817bd2bc8b3edac9d
* | `ActiveRecord::Store` works together with PG `hstore` columns.Yves Senn2013-10-251-0/+8
| | | | | | | | | | | | This is necessary because as of 5ac2341 `hstore` columns are always stored as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to be an instance of `HashWithIndifferentAccess`, which led to the bug.
* | wrap logging around the actual query call itself.Aaron Patterson2013-10-041-25/+21
| | | | | | | | This is to be consistent with the way the mysql2 adapter times queries
* | extract adapter savepoint implementations into `abstract/savepoints.rb`.Yves Senn2013-09-301-12/+0
| |
* | change the savepoint interface to allow passing the name.Yves Senn2013-09-301-6/+6
| |
* | Fixed issue #12327Marc Lennox2013-09-271-2/+2
| |
* | Check if the SQL is not a prepared statementRafael Mendonça França2013-09-111-2/+2
| | | | | | | | | | | | | | | | | | When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023
* | Perf: fields in pg gem causes an allocation, cache itSam2013-08-271-2/+3
| |
* | PG adapter deals with negative money values formatted with parenthesis.Yves Senn2013-08-261-0/+5
| | | | | | | | Closes #11899.
* | Use infinity constKonstantin Shabanov2013-08-221-2/+2
| |
* | Rescue invalid ip address exceptions on assign.Paul Nikitochkin2013-08-141-1/+5
| | | | | | | | In order that set attribute should not be bang method
* | cast hstore values on write to be consistent with reading from the db.Yves Senn2013-08-081-4/+4
| |
* | Fix multidimensional PG arrays containing non-string itemsYves Senn2013-08-071-1/+9
| |
* | Refactor `ArrayParser`Vipul A M2013-07-261-15/+22
| | | | | | | | | | * Constantize parse token * Remove extra param passed to `parse_data`
* | `change_column` for PG adapter respects `:array` option.Yves Senn2013-07-161-2/+3
| |
* | remove deprecated `PostgreSQLAdapter#outside_transaction?` method.Yves Senn2013-07-031-7/+0
|/
* Support array as root element in JSONAlexey Noskov2013-05-142-1/+3
|
* Reject blank order_values within #columns_for_distinct, as the orders aren't ↵Ben Woosley2013-05-101-1/+1
| | | | used at all on non-postgres adapters.
* Fix that #exists? can produce invalid SQL: "SELECT DISTINCT DISTINCT"Ben Woosley2013-05-101-7/+2
| | | | | | | | | | | | The combination of a :uniq => true association and the #distinct call in #construct_limited_ids_condition combine to create invalid SQL, because we're explicitly selecting DISTINCT, and also sending #distinct on to AREL, via the relation#distinct_value. Rather than build a select distinct clause in #construct_limited_ids_condition, I set #distinct! and pass just the columns into the select statement. This requires introducing a #columns_for_distinct method to return the select columns but not the statement itself.
* Make SchemaDumper emit "id: :uuid" when appropriate. Fixes #10451.Brian Buchanan2013-05-031-1/+2
|
* Fix loading of fixtures when the column type is a postgres array of strings.Chris Constantine2013-04-181-1/+1
| | | | - A string in an array of strings that has a quote char (') needs to have that quote char escaped if the array is getting wrapped in quote chars.
* Revert "Merge pull request #10043 from cconstantine/master"Rafael Mendonça França2013-04-181-15/+0
| | | | | | | This reverts commit 521035af530482d6d9ad2dae568eaeb0ab188e1c, reversing changes made to 222011dbee842bbc60d3aaaa3145356b90a30fd1. Reason: This broke the tests
* Merge pull request #10043 from cconstantine/masterRafael Mendonça França2013-04-181-0/+15
|\ | | | | DB with postgres string array column doesn't load fixtures well
| * Fix loading of string arrays in postgresChris Constantine2013-04-081-0/+15
| |