aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
...
* PostgreSQL Timestamps always map to `:datetime`.Jefferson Lai2014-04-241-6/+1
| | | | | | | The PG Adapter should use `:datetime` consistently instead of mapping mispellings to `:timestamp`. See #14513
* Optimize select_value, select_values, select_rows and dry up checking ↵Kris Selden2014-04-171-19/+33
| | | | | 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.
* Changed change_column in PG schema_statements.rb to make sure that the ↵Eric Chahin2014-04-152-2/+17
| | | | uuid_generate function was not being quoted.
* PostgreSQL, adapter automatically reloads it's type map. Closes #14678.Yves Senn2014-04-112-7/+2
| | | | [Yves Senn & Matthew Draper]
* Use connection-specific bytea escapingMatthew Draper2014-04-081-2/+2
| | | | | | | | | | In our normal usage, it's rare for this to make a difference... but is more technically correct. As well as a spec that proves this is a good idea, let's also add a more sane-looking one that just covers basic to_sql functionality. There aren't many places where we actually use escape_bytea, but that's one that won't be going away.
* Treat blank UUID values as nilDmitry Lavrov2014-04-031-1/+8
|
* 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.