aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* :nodoc: postgresql add_columnTony Miller2015-05-131-3/+1
|
* :nodoc: rename_column in postgresql/schema_statements.rbTony Miller2015-05-081-1/+1
| | | | | Its already doc'ed in activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
* Use `select_value` for avoid `ActiveRecord::Result` instance creatingRyuta Kamizono2015-05-051-21/+16
| | | | | `exec_query` create `ActiveRecord::Result` instance. It is better to use `select_value` instead of `exec_query` for performance.
* PostgreSQL: `:collation` support for string and text columnsRyuta Kamizono2015-05-041-2/+12
| | | | | | | | | Example: create_table :foos do |t| t.string :string_en, collation: 'en_US.UTF-8' t.text :text_ja, collation: 'ja_JP.UTF-8' end
* Move the collation handling code from the MySQL adapter to common classesRyuta Kamizono2015-05-041-2/+2
| | | | | Some databases like MySQL allow defining collation charset for specific columns.
* Merge pull request #19988 from kamipo/move_comment_about_microsecondsZachary Scott2015-05-031-2/+1
|\ | | | | Move comment about microseconds [ci skip]
| * Move comment about microseconds [ci skip]Ryuta Kamizono2015-05-031-2/+1
| | | | | | | | The microseconds handling was already moved to `Quoting#quoted_date`.
* | `:nodoc:` postgresql's change_columnTony Miller2015-05-031-2/+1
|/ | | | | Its nodoc'ed for the other implementations, and doc'ed in the base class, just like the other change_column* methods.
* :nodoc: change_column_null in the implmenting adaptersTony Miller2015-05-031-1/+1
| | | | | | `change_column_null` is doc'ed only in ActiveRecord::ConnectionAdapters::SchemaStatements, so it would make sense to :nodoc: it elsewhere.
* Added documentation for PostGreSQL database_statements [ci skip]Prathamesh Sonpatki2015-04-301-0/+3
| | | | | | - Added documentation for index_name_exists? and rename_index. - Also changed rails to \Rails in documentation of allowed_index_name_length.
* No need to document drop_table in the PostgreSQLAdapterRafael Mendonça França2015-04-061-9/+1
| | | | | | It behaves in the same way that the abstract adapter. [ci skip]
* change the explanation of :if_exists option [ci skip]Mehmet Emin İNAÇ2015-04-061-1/+1
|
* drop_table method documentation for mysql and postgresql adapters [ci skip]Mehmet Emin İNAÇ2015-04-061-0/+8
|
* Make method as nodoc since we are already docummenting at AbstractAdapterRafael Mendonça França2015-03-311-1/+1
|
* Reduce memory usage when loading types in PGSean Griffin2015-03-291-4/+16
| | | | | | | | | | | | | We were never clearing the `PG::Result` object used to query the types when the connection is first established. This would lead to a potentially large amount of memory being retained for the life of the connection. Investigating this issue also revealed several low hanging fruit on the performance of these methods, and the number of allocations has been reduced by ~90%. Fixes #19578
* PostgreSQL, Use ruby-pg's built-in capabilities for array en-/decoding in C.Lars Kanis2015-03-252-143/+6
| | | | This obsoletes the ruby based implementations.
* PostgreSQL, Fix OID based type casts in C for primitive types.Lars Kanis2015-03-252-4/+4
| | | | | | | | | | The type map was introduced in aafee23, but wasn't properly filled. This mainly adjusts many locations, that expected strings instead of integers or boolean. add_pg_decoders is moved after setup of the StatementPool, because execute_and_clear could potentially make use of it.
* Delegate limit to subtypewallerjake2015-03-211-1/+1
| | | | | | | | | | As described here https://github.com/rails/rails/issues/19420. When using the Postgres BigInt[] field type the big int value was not being translated into schema.rb. This caused the field to become just a regular integer field when building off of schema.rb. This fix will address this by delegating the limit from the subtype to the Array type. https://github.com/rails/rails/issues/19420
* Don't cast nil to string in pg enumsSean Griffin2015-03-191-1/+3
| | | | Fixes #19389.
* pg, `disable_referential_integrity` only catches AR errors.Yves Senn2015-03-111-2/+2
| | | | This change was prompted by 598b841.
* fix typo in transaction argument. Closes #19265.Yves Senn2015-03-111-1/+1
| | | | | | There was a typo in the `:requires_new` option. This led to `#<ArgumentError: unknown keyword: require_new>` leaving all the triggers in a disabled state.
* Correctly dump `serial` and `bigserial`Ryuta Kamizono2015-03-041-1/+3
|
* [ci skip] Fix a typo for PostgreSQL text limit, GB instead of Gb.Juanito Fatas2015-03-031-2/+2
|
* rework `disable_referential_integrity` for PostgreSQL.Yves Senn2015-02-241-9/+28
| | | | | | | | | | | | | | | | | | | | | | | [Toby Ovod-Everett & Andrey Nering & Yves Senn] Closes #17726. Closes #10939. This patch makes three distinct modifications: 1. no longer fall back to disabling user triggers if system triggers can't be disabled 2. warn the user when referential integrity can't be disabled 3. restore aborted transactions when referential integrity can't be disabled The motivation behind these changes is to make the behavior of Rails transparent and less error-prone. To require superuser privileges is not optimal but it's what Rails currently needs. Users who absolutely rely on disabling user triggers can patch `disable_referential_integrity`. We should investigate `SET CONSTRAINTS` as a possible solution which does not require superuser privileges. /cc @matthewd
* The short-hand methods should be able to define multiple columnsRyuta Kamizono2015-02-231-44/+50
|
* Extract `primary_key` method into `ColumnMethods`Ryuta Kamizono2015-02-221-33/+33
|
* Allow `:precision` option for time type columnsRyuta Kamizono2015-02-201-6/+0
|
* Handle array option in `type_to_sql`Ryuta Kamizono2015-02-191-19/+16
| | | | | `[]` is a part of `sql_type`, so it is always necessary to respect to array option when `type_to_sql` is called.
* Should handle array option for `:cast_as`Ryuta Kamizono2015-02-191-4/+8
|
* Rm `Type#type_cast`Sean Griffin2015-02-176-8/+8
| | | | | | | | | This helper no longer makes sense as a separate method. Instead I'll just have `deserialize` call `cast` by default. This led to a random infinite loop in the `JSON` pg type, when it called `super` from `deserialize`. Not really a great way to fix that other than not calling super, or continuing to have the separate method, which makes the public API differ from what we say it is.
* `type_cast_from_user` -> `cast`Sean Griffin2015-02-171-2/+2
|
* `type_cast_for_database` -> `serialize`Sean Griffin2015-02-1710-12/+12
|
* `Type#type_cast_from_database` -> `Type#deserialize`Sean Griffin2015-02-177-8/+8
|
* Revert "Allow `:precision` option for time type columns"Sean Griffin2015-02-171-0/+7
| | | | | | | | | | This reverts commit 1502caefd30b137fd1a0865be34c5bbf85ba64c1. The test suite for the mysql adapter broke when this commit was used with MySQL 5.6. Conflicts: activerecord/CHANGELOG.md
* Register adapter specific types with the global type registrySean Griffin2015-02-151-38/+0
| | | | | | We do this in the adapter classes specifically, so the types aren't registered if we don't use that adapter. Constants under the PostgreSQL namespace for example are never loaded if we're using mysql.
* Allow `:precision` option for time type columnsRyuta Kamizono2015-02-121-7/+0
|
* Merge pull request #18888 from kamipo/refactor_quote_default_expressionRafael Mendonça França2015-02-112-12/+6
|\ | | | | Refactor `quote_default_expression`
| * Refactor `quote_default_expression`Ryuta Kamizono2015-02-112-12/+6
| | | | | | | | | | | | | | `quote_default_expression` and `quote_default_value` are almost the same handling for do not quote default function of `:uuid` columns. Rename `quote_default_value` to `quote_default_expression`, and remove duplicate code.
* | Remove an unused option that I didn't mean to commit [ci skip]Sean Griffin2015-02-111-2/+1
| |
* | Remove most PG specific type subclassesSean Griffin2015-02-1111-83/+14
|/ | | | | | | | | The latest version of the PG gem can actually convert the primitives for us in C code, which gives a pretty substantial speed up. A few cases were only there to add the `infinity` method, which I just put on the range type (which is the only place it was used). Floats also needed to parse `Infinity` and `NaN`, but it felt reasonable enough to put that on the generic form.
* Refactor microsecond precision to be database agnosticSean Griffin2015-02-101-9/+0
| | | | | | | | | | The various databases don't actually need significantly different handling for this behavior, and they can achieve it without knowing about the type of the object. The old implementation was returning a string, which will cause problems such as breaking TZ aware attributes, and making it impossible for the adapters to supply their logic for time objects.
* Merge pull request #18849 from kamipo/array_type_is_a_part_of_sql_typeSean Griffin2015-02-091-18/+3
|\ | | | | An array type is a part of `sql_type`
| * An array type is a part of `sql_type`Ryuta Kamizono2015-02-081-18/+3
| | | | | | | | | | | | `sql_type` is reused in `lookup_cast_type`. If making it a part of `sql_type` when handled array option first, it isn't necessary to do again.
* | Fix rounding problem for PostgreSQL timestamp columnRyuta Kamizono2015-02-081-0/+9
|/ | | | | If timestamp column have the precision, it need to format according to the precision of timestamp column.
* rm `Type#text?`Sean Griffin2015-02-071-4/+0
| | | | | | | | | | | | | | | | This predicate was only to figure out if it's safe to do case insensitive comparison, which is only a problem on PG. Turns out, PG can just tell us whether we are able to do it or not. If the query turns out to be a problem, let's just replace that method with checking the SQL type for `text` or `character`. I'd rather not burden the type objects with adapter specific knowledge. The *real* solution, is to deprecate this behavior entirely. The only reason we need it is because the `:case_sensitive` option for `validates_uniqueness_of` is documented as "this option is ignored for non-strings". It makes no sense for us to do that. If the type can't be compared in a case insensitive way, the user shouldn't tell us to do case insensitive comparison.
* 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-063-1/+54
| | | | | | | | | | | | | | | | | | 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).
* Add default options to 'bit' and 'bit_varying' methodsMelody2015-02-031-2/+2
|
* Adds default options hash for postgres money typeMelody Berton2015-02-031-1/+1
|
* rm `Column#cast_type`Sean Griffin2015-02-033-18/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type from the column is never used, except when being passed to the attributes API. While leaving the type on the column wasn't necessarily a bad thing, I worry that it's existence there implies that it is something which should be used. During the design and implementation process of the attributes API, there have been plenty of cases where getting the "right" type object was hard, but I had easy access to the column objects. For any contributor who isn't intimately familiar with the intents behind the type casting system, grabbing the type from the column might easily seem like the "correct" thing to do. As such, the goal of this change is to express that the column is not something that should be used for type casting. The only places that are "valid" (at the time of this commit) uses of acquiring a type object from the column are fixtures (as the YAML file is going to mirror the database more closely than the AR object), and looking up the type during schema detection to pass to the attributes API Many of the failing tests were removed, as they've been made obsolete over the last year. All of the PG column tests were testing nothing beyond polymorphism. The Mysql2 tests were duplicating the mysql tests, since they now share a column class. The implementation is a little hairy, and slightly verbose, but it felt preferable to going back to 20 constructor options for the columns. If you are git blaming to figure out wtf I was thinking with them, and have a better idea, go for it. Just don't use a type object for this.