aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* Don't rely on the column SQL type for bit string quotingSean Griffin2014-07-112-13/+33
|
* Merge pull request #16071 from sgrif/sg-pg-type-castRafael Mendonça França2014-07-081-15/+0
|\ | | | | Remove PG's definition of `type_cast`
| * Remove PG's definition of `type_cast`Sean Griffin2014-07-061-15/+0
| | | | | | | | | | All cases except for `nil` in an array have been removed. `nil` in an array is handled by the Array type object.
* | Merge pull request #16072 from sgrif/sg-xml-quotingRafael Mendonça França2014-07-083-3/+41
|\ \ | | | | | | Don't rely on the sql type to quote XML columns in PG
| * | Don't rely on the sql type to quote XML columns in PGSean Griffin2014-07-063-3/+41
| |/
* / Remove the `text?` predicate from the type objectsSean Griffin2014-07-061-4/+0
|/ | | | | | | This was only used for uniqueness validations. The first usage was in conjunction with `limit`. Types which cast to string, but are not considered text cannot have a limit. The second case was only with an explicit `:case_sensitive => true` option given by the user.
* Use the type object for quoting PG RangesSean Griffin2014-07-054-48/+34
|
* Merge pull request #16037 from sgrif/sg-money-quotingRafael Mendonça França2014-07-041-7/+0
|\ | | | | Remove unneccessary special case for money in quoting
| * Remove unneccessary special case for money in quotingSean Griffin2014-07-031-7/+0
| |
* | Merge pull request #16036 from sgrif/sg-datetime-infinityRafael Mendonça França2014-07-032-3/+2
|\ \ | | | | | | Do not rely on the column type when quoting infinity
| * | Do not rely on the column type when quoting infinitySean Griffin2014-07-032-3/+2
| |/
* / Use the type object for type casting HStore columnsSean Griffin2014-07-033-55/+34
|/
* Quote range strings when quoting PG rangesSean Griffin2014-07-021-1/+1
| | | | | The test case for CVE-2014-3483 doesn't actually send the generated SQL to the database. The generated SQL is actually invalid for real inputs.
* Fix SQL injection when querying against ranges and bitstringsRafael Mendonça França2014-07-021-3/+4
| | | | Fix CVE-2014-3483 and protect against CVE-2014-3482.
* Merge pull request #15977 from sgrif/sg-remove-array-hackGodfrey Chan2014-06-291-24/+0
|\ | | | | Remove array workaround in PG quoting
| * Remove array workaround in PG quotingSean Griffin2014-06-291-24/+0
| | | | | | | | | | We no longer need to do fancy legwork to make sure arrays use a type object, now that schema methods use a real type object.
* | Remove unused `array_member` from PG quoting for HStore columnsSean Griffin2014-06-292-12/+9
|/ | | | | Hstore no longer needs additional quoting to be used in an array, the array type handles it sufficiently.
* Use the type object when sending point columns to the DBSean Griffin2014-06-293-19/+9
|
* Use the type object for sending JSON to the databaseSean Griffin2014-06-293-22/+10
|
* Always pass a column with a type object to quoteSean Griffin2014-06-281-0/+8
| | | | | | | | The only case where we got a column that was not `nil`, but did not respond to `cast_type` was when type casting the default value during schema creation. We can look up the cast type, and add that object to the column definition. Will allow us to consistently rely on the type objects for type casting in all directions.
* rename sequence only if it existsAbdelkader Boudih2014-06-271-3/+3
|
* fk: review corrections: indent, visibility, syntax, wording.Yves Senn2014-06-261-12/+12
|
* fk: support for on_updateYves Senn2014-06-261-7/+12
|
* fk: rename `dependent` to `on_delete`Yves Senn2014-06-261-2/+2
|
* fk: support dependent option (:delete, :nullify and :restrict).Yves Senn2014-06-261-1/+8
|
* fk: generalize using `AlterTable` and `SchemaCreation`.Yves Senn2014-06-261-20/+0
|
* fk: `foreign_keys`, `add_foreign_key` and `remove_foreign_key` for MySQLYves Senn2014-06-262-21/+0
|
* fk: add `foreign_keys` for PostgreSQL adapter.Yves Senn2014-06-262-0/+38
|
* fk: `add_foreign_key` and `remove_foreign_key` for PostgreSQL adapter.Yves Senn2014-06-261-0/+27
|
* add missing `:nodoc:` for recent refactorings. [ci skip]Yves Senn2014-06-2423-23/+23
| | | | | | | | | | Adding `# :nodoc:` to the parent `class` / `module` is not going to ignore nested classes or modules. There is a modifier `# :nodoc: all` but sadly the containing class or module will continue to be in the docs. /cc @sgrif
* Don't use column object for type casting in `quoting`Sean Griffin2014-06-181-2/+2
| | | | | | | | | We're never going to be able to use the attribute object here, however, so let's just accept the ugly demeter violation here for now. Remove test cases which were either redundant with other tests in the file, or were actually testing the type objects (which are tested elsewhere)
* Detect in-place changes on point typesSean Griffin2014-06-172-3/+20
|
* Detect mutations of arrays and array membersSean Griffin2014-06-171-12/+14
|
* Ensure `OID::Array#type_cast_for_database` matches PG's quoting behaviorSean Griffin2014-06-172-7/+21
| | | | | | Also takes a step towards supporting types which use a character other than ',' for the delimiter (`box` is the only built in type for which this is the case)
* Merge pull request #15778 from sgrif/sg-pg-mutable-arraysMatthew Draper2014-06-183-38/+52
|\ | | | | Move pg array database type casting to the Array type
| * Move array database type casting to the Array typeSean Griffin2014-06-173-38/+52
| | | | | | | | | | | | | | | | | | The case where we have a column object, but don't have a type cast method involves type casting the default value when changing the schema. We get one of the column definition structs instead. That is a case that I'm trying to remove overall, but in the short term, we can achieve the same behavior without needing to pass the adapter to the array type by creating a fake type that proxies to the adapter.
* | Don't assume that Hstore columns have always changedSean Griffin2014-06-171-1/+1
|/ | | | | | | | | HStore columns come back from the database separated by a comma and a space, not just a comma. We need to mirror that behavior since we compare the two values. Also adds a regression test against JSON to ensure we don't have the same bug there.
* Merge pull request #15674 from sgrif/sg-mutable-attributesMatthew Draper2014-06-142-8/+4
|\ | | | | Detect in-place changes on mutable AR attributes
| * Detect in-place changes on mutable AR attributesSean Griffin2014-06-132-8/+4
| | | | | | | | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* | Merge pull request #15593 from sgrif/sg-attributeRafael Mendonça França2014-06-131-2/+3
|\ \ | | | | | | Introduce an Attribute object to handle the type casting dance
| * | Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-131-2/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types
* / PG arrays should type cast user inputSean Griffin2014-06-131-4/+8
|/ | | | | | We guarantee that `model.value` does not change after `model.save && model.reload`. This requires type casting user input for non-string types.
* Inline PG array type casting helperSean Griffin2014-06-103-34/+28
|
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-094-12/+12
| | | | | | | | In some cases there is a difference between the two, we should always be doing one or the other. For convenience, `type_cast` is still a private method on type, so new types that do not need different behavior don't need to implement two methods, but it has been moved to private so it cannot be used accidentally.
* Make `_before_type_cast` actually be before type castSean Griffin2014-06-092-2/+10
| | | | | | | | | | | | | - The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types
* Don't mess with `_before_type_cast` for numeric typesSean Griffin2014-06-061-2/+1
|
* Merge pull request #15503 from sgrif/sg-json-hstore-storageYves Senn2014-06-062-12/+0
|\ | | | | Bring type casting behavior of hstore/json in line with serialized
| * Bring type casting behavior of hstore/json in line with serializedSean Griffin2014-06-042-12/+0
| | | | | | | | | | `@raw_attributes` should not contain the type-cast, mutable version of the value.
* | Fix behavior of handling BC era dates.edogawaconan2014-06-052-3/+5
|/ | | | BC era year is (astronomical year + 1) and starts from 1 BC.
* Merge pull request #15486 from sgrif/sg-binary-quotingMatthew Draper2014-06-041-10/+21
|\ | | | | Refactor quoting of binary data to not be based on the column type