aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
| |
| * Initialize `column.table_name` immediately for `column.serial?` correctly ↵Ryuta Kamizono2016-03-082-3/+5
| | | | | | | | | | | | | | | | working Currently the results of `column.serial?` is not correct. For `column.serial?` correctly working, initialize `column.table_name` immediately.
* | Merge pull request #23958 from kamipo/fix_bigserial_appears_with_limit_8Rafael França2016-03-111-0/+4
|\ \ | |/ |/| Fix bigserial appears with limit 8 for schema dumper
| * Fix bigserial appears with limit 8 for schema dumperRyuta Kamizono2016-03-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ```ruby create_table "postgresql_big_serials", force: :cascade do |t| t.bigserial "seq", limit: 8, null: false end ``` After: ```ruby create_table "postgresql_big_serials", force: :cascade do |t| t.bigserial "seq", null: false end ```
* | Remove outdated comment [ci skip]Ryuta Kamizono2016-03-041-1/+0
|/ | | | Currently column options handled by the type map in Rails 4.2.
* Exclude `:name` and `:type` from `prepare_column_options`Ryuta Kamizono2016-02-291-1/+1
| | | | Actually `:name` and `:type` are not column options.
* eliminate warnings about multiple primary keys on habtm join tablesAaron Patterson2016-02-191-1/+1
| | | | | | | | habtm join tables commonly have two id columns and it's OK to make those two id columns a primary key. This commit eliminates the warnings for join tables that have this setup. ManageIQ/manageiq#6713
* `schema_type` returns symbol rather than stringRyuta Kamizono2016-02-081-3/+3
| | | | | | | | | A return value of `schema_type` is used by: 1. primary key type: using as `symbol.inspect` 2. normal column type: using as `symbol.to_s` It is better to return symbol.
* Extract `ExplainPrettyPrinter` to appropriate filesRyuta Kamizono2016-02-012-38/+43
|
* `OID::Money.precision` is unused since #15239Ryuta Kamizono2016-01-311-2/+0
| | | | | | | | p PostgreSQLAdapter::OID::Money.precision # => 19 p PostgreSQLAdapter::OID::Money.new.precision # => nil
* Revert "Merge pull request #23346 from kamipo/refactor_oid_money_precision"Rafael Mendonça França2016-01-301-4/+2
| | | | | | | This reverts commit ff835f90800a3e4122d64606cb328908c2e0e071, reversing changes made to c4d85dfbc71043e2a746acd310e32f4f04db801a. Reason: This broke the tests. We will add back after investigated.