aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql/oid
Commit message (Collapse)AuthorAgeFilesLines
* Move non-type objects into the `Type::Helpers` namespaceSean Griffin2015-02-074-4/+4
| | | | | | | The type code is actually quite accessible, and I'm planning to encourage people to look at the files in the `type` folder to learn more about how it works. This will help reduce the noise from code that is less about type casting, and more about random AR nonsense.
* Allow a symbol to be passed to `attribute`, in place of a type objectSean Griffin2015-02-062-1/+13
| | | | | | | | | | | | | | | | | | The same is not true of `define_attribute`, which is meant to be the low level no-magic API that sits underneath. The differences between the two APIs are: - `attribute` - Lazy (the attribute will be defined after the schema has loaded) - Allows either a type object or a symbol - `define_attribute` - Runs immediately (might get trampled by schema loading) - Requires a type object This was the last blocker in terms of public interface requirements originally discussed for this feature back in May. All the implementation blockers have been cleared, so this feature is probably ready for release (pending one more look-over by me).
* Don't error when invalid json is assigned to a JSON columnSean Griffin2015-01-211-1/+1
| | | | | | | Keeping with our behavior elsewhere in the system, invalid input is assumed to be `nil`. Fixes #18629.
* Time columns should support time zone aware attributesSean Griffin2015-01-151-1/+1
| | | | | | The types that are affected by `time_zone_aware_attributes` (which is on by default) have been made configurable, in case this is a breaking change for existing applications.
* remove deprecated support for PG ranges with exclusive lower bounds.Yves Senn2015-01-051-10/+1
| | | | addresses https://github.com/rails/rails/commit/91949e48cf41af9f3e4ffba3e5eecf9b0a08bfc3#commitcomment-9144563
* PostgreSQL, Fix change detection caused by wrong data for bytea unescaping.Lars Kanis2014-12-291-0/+1
| | | | | | | | | | This showed up when running BinaryTest#test_load_save with the more restrictive input string handling of pg-0.18.0.pre20141117110243.gem . Bytea values sent to the server are in binary format, but are returned back as escaped text. To fulfill the assumption that type_cast_from_database(type_cast_for_database(binary)) == binary we unescape only, if the value was really received from the server.
* Correctly ignore `case_sensitive` for UUID uniqueness validationSean Griffin2014-12-261-0/+4
| | | | | | | | I think we should deprecate this behavior and just error if you tell us to do a case insensitive comparison for types which are not case sensitive. Partially reverts 35592307 Fixes #18195
* Relax the UUID regexGodfrey Chan2014-12-181-9/+2
| | | | | | | | Apparently PG does not validate against RFC 4122. The intent of the original patch is just to protect against PG errors (which potentially breaks txns, etc) because of bad user input, so we shouldn't try any harder than PG itself. Closes #17931
* Revert to 4.1 behavior for casting PG arraysSean Griffin2014-12-081-0/+3
| | | | | | | | | | The user is able to pass PG string literals in 4.1, and have it converted to an array. This is also possible in 4.2, but it would remain in string form until saving and reloading, which breaks our `attr = save.reload.attr` contract. I think we should deprecate this in 5.0, and only allow array input from user sources. However, this currently constitutes a breaking change to public API that did not go through a deprecation cycle.
* Correctly respect subtypes for PG arrays and rangesSean Griffin2014-12-051-7/+19
| | | | | | | | | | | | | The type registration was simply looking for the OID, and eagerly fetching/constructing the sub type when it was registered. However, numeric types have additional parameters which are extracted from the actual SQL string of the type during lookup, and can have their behavior change based on the result. We simply need to use the block form of registration, and look up the subtype lazily instead. Fixes #17935
* Remove redundant `to_s` in interpolationclaudiob2014-10-301-3/+3
|
* let's warn with heredocsXavier Noria2014-10-281-4/+7
| | | | | | | | | | | | The current style for warning messages without newlines uses concatenation of string literals with manual trailing spaces where needed. Heredocs have better readability, and with `squish` we can still produce a single line. This is a similar use case to the one that motivated defining `strip_heredoc`, heredocs are super clean.
* Fix description of OID in TypeMapInitializerPrathamesh Sonpatki2014-10-251-1/+1
| | | | [ci skip]
* Avoid using heredoc for user warningsGodfrey Chan2014-08-281-4/+4
| | | | | | | | | | Using heredoc would enforce line wrapping to whatever column width we decided to use in the code, making it difficult for the users to read on some consoles. This does make the source code read slightly worse and a bit more error-prone, but this seems like a fair price to pay since the primary purpose for these messages are for the users to read and the code will not stick around for too long.
* adding the exception RecordNotFound to UUID findJoseLuis Torres2014-08-211-0/+2
|
* Spelling errorsjbsmith862014-08-141-1/+1
|
* Remove unused text? predicate method and delegationCarlos Antonio da Silva2014-08-051-4/+0
| | | | | | | | The method has been removed in 09206716f8695f6b8467f15c1befa5a4c3c10978 (PR #16074), but the delegation was apparently missed, and one instance of the method was added back with the addition of OID::Xml in 336be2bdf7dfa1b31879d0ab27e5f3101b351923 (PR #16072), so we can safely rm both.
* Add support for Postgresql JSONBPhilippe Creux2014-07-241-0/+23
| | | | [Philippe Creux, Chris Teague]
* Treat invalid uuid as nilAbdelkader Boudih2014-07-141-1/+10
|
* Don't rely on the column SQL type for bit string quotingSean Griffin2014-07-111-0/+26
|
* Merge pull request #16072 from sgrif/sg-xml-quotingRafael Mendonça França2014-07-081-0/+32
|\ | | | | 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-061-0/+32
| |
* | 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-051-18/+34
|
* Merge pull request #16036 from sgrif/sg-datetime-infinityRafael Mendonça França2014-07-031-0/+1
|\ | | | | Do not rely on the column type when quoting infinity
| * Do not rely on the column type when quoting infinitySean Griffin2014-07-031-0/+1
| |
* | Use the type object for type casting HStore columnsSean Griffin2014-07-031-2/+34
|/
* Use the type object when sending point columns to the DBSean Griffin2014-06-291-1/+7
|
* Use the type object for sending JSON to the databaseSean Griffin2014-06-291-2/+10
|
* add missing `:nodoc:` for recent refactorings. [ci skip]Yves Senn2014-06-2422-22/+22
| | | | | | | | | | 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
* Detect in-place changes on point typesSean Griffin2014-06-171-2/+15
|
* 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)
* Move array database type casting to the Array typeSean Griffin2014-06-171-0/+30
| | | | | | | | | 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.
* 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-101-4/+26
|
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-093-11/+11
| | | | | | | | 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-051-1/+2
|/ | | | BC era year is (astronomical year + 1) and starts from 1 BC.
* pg, preserve money type when dumping schema and extract money default.Yves Senn2014-06-031-0/+4
|
* pg, preserve type when schema dumping bit and bit varying columns.Yves Senn2014-06-032-1/+18
|
* pg, preserve point type when schema dumping.Yves Senn2014-06-031-1/+5
|
* pg, inline casting methods into `OID::Type` objects.Yves Senn2014-06-022-2/+25
| | | | | | | | This inlines casting for the most obvious types. The rest will follow eventually. I need to put some tests in place, to make sure that the inlining is not causing regressions. /cc @sgrif