aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #26905 from bogdanvlviv/docsAndrew White2016-11-131-1/+1
|\ | | | | Add missing `+` around a some literals.
| * Add missing `+` around a some literals.bogdanvlviv2016-10-271-1/+1
| | | | | | | | | | | | Mainly around `nil` [ci skip]
* | Refactor column initialization into `new_column_from_field`Kir Shatrov2016-11-111-15/+17
| | | | | | | | that accepts results of SHOW FIELDS
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-2/+2
| |
* | Permit loads while queries are runningMatthew Draper2016-10-271-2/+6
| | | | | | | | | | A query may wait on a database-level lock, which could lead to a deadlock between threads.
* | Use Regexp#match? rather than Regexp#===Ryuta Kamizono2016-10-262-3/+3
|/ | | | Follow up to 99cf7558000090668b137085bfe6bcc06c4571dc.
* Quote table name properlyRyuta Kamizono2016-10-141-8/+8
| | | | If does not quote table name properly, invalid SQL is generated.
* Fix table comment dumpingRyuta Kamizono2016-10-111-1/+3
| | | | | | | | | | | | | Follow up to #26735. If `table_options` returns `{ comment: nil }`, `create_table` line is broken. Example: ```ruby create_table "accounts", force: :cascade, do |t| ```
* [ci skip] Update PG adapter documentationAlex Kitchens2016-09-261-1/+1
| | | | | | | | Per discussion in pull request #26622: "Let's change it to PG::Error. The more specific classes mentioned are subclasses, and the fact the raised exception is a PG::UndefinedColumn doesn't change the fact that it's also a PG::Error." - matthewd
* [ci skip] Clarify Postgresql DocumentationAlex Kitchens2016-09-251-4/+4
| | | | | This clarifies the object that +ActiveRecord::Base.connection.execute+ will return when using Postgresql.
* Fix Remaining Case-In-Assignment Statement FormattingAlex Kitchens2016-09-061-25/+26
| | | | | | | | | Recently, the Rails team made an effort to keep the source code consistent, using Ruboco (bb1ecdcc677bf6e68e0252505509c089619b5b90 and below). Some of the case statements were missed. This changes the case statements' formatting and is consistent with changes in 810dff7c9fa9b2a38eb1560ce0378d760529ee6b and db63406cb007ab3756d2a96d2e0b5d4e777f8231.
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-2/+2
|
* Remove deprecated handling of PG PointsSean Griffin2016-08-313-19/+30
| | | | | | | | | | There are some minor changes to the point type as I had forgotten that this will affect the behavior of `t.point` in migrations and the schema dumper so we need to handle those as well. I'll say this again so I can convince myself to come up with a better structure... TYPES SHOULD NOT CARE ABOUT SCHEMA DUMPING AND WE NEED TO BETTER SEPARATE THESE.
* Attempt to maintain encoding for arrays of strings with PGSean Griffin2016-08-311-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | I still think that this is something that should be handled in the pg gem, but it's not going to end up happening there so we'll do it here instead. Once we bump to pg 0.19 we can pass the encoding to the `encode` method instead. This issue occurs because C has no concept of encoding (or strings, really). The bytes that we pass here when sending the value to the database will always be interpreted as whatever encoding the connection is currently configured to use. That means that roundtripping to the database will lose no information However, after assigning we round trip through our type system without hitting the database. The only way that we can do the "correct" thin here would be to actually give a reference to the connection to the array type and have it check the current value of the connection's encoding -- which I'm strongly opposed to. We could also pass in the encoding when it's constructed, but since that can change independently of the type I'm not a huge fan of that either. This feels like a reasonable middle ground, where if we have an array of strings we simply use the encoding of the string we're given. Fixes #26326.
* Fix `OID::Bit#cast_value`Ryuta Kamizono2016-08-201-2/+2
| | | | Fixes #26137.
* Remove unnecessary `test_sql_for_insert_with_returning_disabled`Ryuta Kamizono2016-08-181-3/+2
| | | | | Because `sql_for_insert` is only called in `use_insert_returning?` is true since #26002.
* Merge pull request #26002 from ↵Rafael França2016-08-171-6/+10
|\ | | | | | | | | kamipo/sql_for_insert_should_be_called_inside_exec_insert `sql_for_insert` should be called inside `exec_insert`
| * `sql_for_insert` should be called inside `exec_insert`Ryuta Kamizono2016-08-061-6/+10
| | | | | | | | | | `exec_insert` cannot return last inserted id if `use_insert_returning?` is true. `sql_for_insert` should be called inside `exec_insert`.
* | Add three new rubocop rulesRafael Mendonça França2016-08-163-3/+3
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | applies remaining conventions across the projectXavier Noria2016-08-061-34/+34
| |
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-0613-161/+161
| |
* | applies new string literal convention in activerecord/libXavier Noria2016-08-0616-118/+118
|/ | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Make `name` and `binds` to optional args for `exec_{insert,update,delete}`Ryuta Kamizono2016-08-041-2/+2
| | | | | | `insert`, `update`, `delete`, and `exec_query` have a default value against `name` and `binds`. But `exec_insert`, `exec_update`, and `exec_delete` not have. It is an inconvenience and inconsistent.
* Merge pull request #25340 from kamipo/prevent_table_comment_queryRafael França2016-07-281-0/+4
|\ | | | | Prevent `table_comment` query if a table doesn't have a comment
| * Prevent `table_comment` query if a table doesn't have a commentRyuta Kamizono2016-06-101-0/+4
| |
* | `@quoted_{column,table}_names` should cache a frozen stringRyuta Kamizono2016-07-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Caching a mutable string causes the following issue. ``` Loading development environment (Rails 5.1.0.alpha) irb(main):001:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!" irb(main):002:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!!!" irb(main):003:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!' => "`foo`!!!!!!" ```
* | systematic revision of =~ usage in ARXavier Noria2016-07-231-1/+1
| | | | | | | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* | Merge pull request #25578 from ↵Rafael França2016-07-201-0/+8
|\ \ | | | | | | | | | | | | kamipo/move_warning_about_composite_primary_key_to_attribute_methods_primary_key Move the warning about composite primary key to `AttributeMethods::PrimaryKey`
| * | Move the warning about composite primary key to `AttributeMethods::PrimaryKey`Ryuta Kamizono2016-07-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually schema dumper/creation supports composite primary key (#21614). Therefore it should not show the warning about composite primary key in connection adapter. This change moves the warning to `AttributeMethods::PrimaryKey` and suppress the warning for habtm join table. Fixes #25388.
* | | Refactored method ↵bogdanvlviv2016-07-171-3/+3
|/ / | | | | | | `ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`
* | Merge pull request #25307 from ↵Eileen M. Uchitelle2016-07-011-1/+1
|\ \ | | | | | | | | | | | | kamipo/extract_foreign_key_action_from_information_schema Extract foreign key action from `information_schema`
| * | Make `foreign_keys` queries to `SCHEMA`Ryuta Kamizono2016-06-071-1/+1
| |/
* / Fix error message to talk about the scale not precision of the typeRafael Mendonça França2016-06-131-1/+1
|/ | | | Fixes #25391
* Rails 5.1 point type should not raise exception if empty string is provided ↵bUg2016-05-151-0/+2
| | | | as value
* Treat blank comments as no comment for indexesRyuta Kamizono2016-04-291-1/+1
| | | | | | Follow up of 1683410. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Add Expression Indexes and Operator Classes support for PostgreSQLRyuta Kamizono2016-04-241-15/+20
| | | | | | | | | | | | | | | | Example: create_table :users do |t| t.string :name t.index 'lower(name) varchar_pattern_ops' end Fixes #19090. Fixes #21765. Fixes #21819. Fixes #24359. Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Move `require 'ipaddr'` in `postgresql/oid/cidr.rb`Ryuta Kamizono2016-04-241-0/+2
| | | | `IPAddr` is used in `OID::Cidr`.
* Fix `test_blank_columns_created_in_block`Ryuta Kamizono2016-04-201-1/+1
| | | | Follow up to 1683410.
* Merge pull request #23622 from kamipo/primary_key_should_be_not_nullJeremy Daer2016-04-181-1/+1
|\ | | | | | | Primary key should be `NOT NULL`
| * Primary key should be `NOT NULL`Ryuta Kamizono2016-03-121-1/+1
| | | | | | | | | | | | | | Follow up to #18228. In MySQL and PostgreSQL, primary key is to be `NOT NULL` implicitly. But in SQLite it must be specified `NOT NULL` explicitly.
* | Database comments: switch to keyword args for new table optionsJeremy Daer2016-04-181-16/+16
| | | | | | | | | | | | * Switch to keyword args where we can without breaking compat. * Use add_table_options! for :options, too. * Some code polish.
* | Add support for specifying comments for tables, columns, and indexes.Andrey Novikov2016-04-161-8/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Comments are specified in migrations, stored in database itself (in its schema), and dumped into db/schema.rb file. This allows to generate good documentation and explain columns and tables' purpose to everyone from new developers to database administrators. For PostgreSQL and MySQL only. SQLite does not support comments at the moment. See docs for PostgreSQL: http://www.postgresql.org/docs/current/static/sql-comment.html See docs for MySQL: http://dev.mysql.com/doc/refman/5.7/en/create-table.html
* | Pass over all Rails 5 warnings, to make sure:Vipul A M2016-04-121-2/+2
| | | | | | | | | | | | | | | | | | | | - we are ending sentences properly - fixing of space issues - fixed continuity issues in some sentences. Reverts https://github.com/rails/rails/commit/8fc97d198ef31c1d7a4b9b849b96fc08a667fb02 . This change reverts making sure we add '.' at end of deprecation sentences. This is to keep sentences within Rails itself consistent and with a '.' at the end.
* | Move `@quoted_{column|table}_names` cache up to the abstract adapterRyuta Kamizono2016-03-311-4/+4
|/
* Merge pull request #24054 from kamipo/extract_default_primary_keyRafael França2016-03-111-10/+7
|\ | | | | Extract `default_primary_key?` to refactor `column_spec_for_primary_key`
| * Extract `default_primary_key?` to refactor `column_spec_for_primary_key`Ryuta Kamizono2016-03-111-10/+7
| |
* | Merge pull request #24087 from kamipo/dump_bigint_instead_of_integer_limit_8Rafael França2016-03-111-4/+0
|\ \ | | | | | | Dump `bigint` instead of `integer` with `limit: 8` for schema dumper
| * | Dump `bigint` instead of `integer` with `limit: 8` for schema dumperRyuta Kamizono2016-03-111-4/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ```ruby create_table "big_numbers", force: :cascade do |t| t.integer "bigint_column", limit: 8 end ``` After: ```ruby create_table "big_numbers", force: :cascade do |t| t.bigint "bigint_column" end ```
* | Merge pull request #23677 from kamipo/passing_table_name_to_column_initializeRafael França2016-03-112-5/+5
|\ \ | |/ |/| Passing `table_name` to `Column#initialize` to avoid `instance_variable_set`
| * Passing `table_name` to `Column#initialize` to avoid `instance_variable_set`Ryuta Kamizono2016-03-081-5/+3
| |