aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary `test_sql_for_insert_with_returning_disabled`Ryuta Kamizono2016-08-181-6/+0
| | | | | Because `sql_for_insert` is only called in `use_insert_returning?` is true since #26002.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-6/+6
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-2/+2
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-78/+78
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Add Expression Indexes and Operator Classes support for PostgreSQLRyuta Kamizono2016-04-241-0/+16
| | | | | | | | | | | | | | | | 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>
* Deprecate `{insert|update|delete}_sql` in `DatabaseStatements`Ryuta Kamizono2016-03-021-44/+0
| | | | | Originally, `{insert|update|delete}_sql` is protected methods. We can use the `{insert|update|delete}` public methods instead.
* Fix tests failure with `prepared_statements: false`Ryuta Kamizono2016-02-291-61/+23
| | | | | | Some tests does not work for unprepared statements. Add `if ActiveRecord::Base.connection.prepared_statements` and fix a regex for fix tests failure with `prepared_statements: false`.
* Remove duplicated composite primary key testsRyuta Kamizono2016-02-011-8/+0
|
* :speak_no_evil: :warning:Akira Matsuda2016-02-011-1/+3
|
* `sql_for_insert` returns values for passing to `exec_insert`Ryuta Kamizono2016-01-151-2/+2
|
* `substitute_at` is no longer usedRyuta Kamizono2016-01-141-5/+0
| | | | Arel handles substitution for bind parameters by now.
* Merge pull request #21697 from gdeglin/fix_returning_disabled_default_values_bugSean Griffin2015-09-241-0/+14
|\ | | | | | | Fix a bug with returning_disabled when using the postgresql adapter
| * Fix a bug with returning_disabled when using the postgresql adapterGeorge Deglin2015-09-201-0/+15
|/ | | | The returning_disabled configuration option is required to make postgresql partitioning triggers work. This commit fixes a bug where an invalid query would be made in cases where returning_disabled was true and objects were created with no attributes defined.
* make it possible to run AR tests with bin/testYves Senn2015-06-111-1/+1
|
* PostgreSQL, Fix OID based type casts in C for primitive types.Lars Kanis2015-03-251-8/+8
| | | | | | | | | | 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.
* Prefer `drop_table if_exists: true` over raw SQLRyuta Kamizono2015-02-181-2/+2
| | | | | Lowercase raw SQL has been replaced by 07b659c already. This commit replaces everything else of raw SQL.
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Remove Relation#bind_paramsSean Griffin2015-01-271-6/+10
| | | | | | | | `bound_attributes` is now used universally across the board, removing the need for the conversion layer. These changes are mostly mechanical, with the exception of the log subscriber. Additional, we had to implement `hash` on the attribute objects, so they could be used as a key for query caching.
* Ensures that primary_key method will return nil when multi-pkArthur Neves2014-12-301-0/+6
| | | | | | | When table has a composite primary key, the `primary_key` method for sqlite3 and postgresql was only returning the first field of the key. Ensures that it will return nil instead, as AR dont support composite pks.
* Remove the unused second argument to `substitute_at`Sean Griffin2014-11-171-1/+1
| | | | Oh hey, we got to remove some code because of that!
* rm `reorder_bind_params`Sean Griffin2014-11-171-4/+1
| | | | | | Arel handles this for us automatically. Updated tests, as BindParam is no longer a subclass of SqlLiteral. We should remove the second argument to substitute_at entirely, as it's no longer used
* pg, `default_sequence_name` needs to return a string.Yves Senn2014-08-251-6/+6
| | | | | | | | | This is a reacon to https://github.com/rails/rails/commit/d6c1205584b1ba597db4071b168681678b1e9875#commitcomment-7502487 This backwards incompatibility was introduced with d6c12055 to fix #7516. However both `connection.default_sequence_name` and `model.sequence_name` are public API. The PostgreSQL adapter should honor the interface and return strings. /cc @matthewd @chancancode
* Don't trim excess whitespace in pg #columns_for_distinctAgis-2014-08-241-0/+8
| | | | Fixes #16623 introduced by https://github.com/rails/rails/commit/3d5a2019bcccc6fb01bee4811ca669f4383edb51
* pg, `default_sequence_name` respects schema. Closes #7516.Yves Senn2014-05-301-8/+6
|
* Merge pull request #11896 from nkondratyev/fix_pg_columns_for_distinctYves Senn2014-05-301-0/+11
|\ | | | | | | | | | | | | Fixed #columns_for_distinct of postgresql adapter Conflicts: activerecord/CHANGELOG.md
| * Fixed `columns_for_distinct` of postgresql adapterNikolay Kondratyev2013-08-151-0/+11
| |
* | pg, `reset_pk_sequence!` respects schemas. Closes #14719.Yves Senn2014-05-301-3/+5
| |
* | test, regression test for unparsable PostgreSQL defaults.Yves Senn2014-05-081-0/+17
| | | | | | | | | | This test was inspired by #14866. That PR would break this functionality and we should make sure we notice that in the future.
* | PostgreSQL, warn once per connection per missing OID. Closes #14275.Yves Senn2014-04-111-0/+11
| | | | | | | | [Yves Senn & Matthew Draper]
* | PostgreSQL, adapter automatically reloads it's type map. Closes #14678.Yves Senn2014-04-111-0/+28
| | | | | | | | [Yves Senn & Matthew Draper]
* | Extract with_example_table into helper method.Guo Xiang Tan2014-03-201-6/+5
| | | | | | | | This setups the helper method which other tests can benefit from.
* | Postgres schema: Constrain sequence search classidJosh Williams2014-03-201-0/+45
| | | | | | | | | | | | | | | | | | | | | | The pk_an_sequence_for query previously joined against pg_class's oid for rows in pg_depend, but pg_depend's objid may point to other system tables, such as pg_attrdef. If a row in one of those other tables coincidentally has the same oid as an (unrelated) sequence, that sequence name may be returned instead of the real one. This ensures that only the pg_depend entries pointing to pg_class are considered.
* | tests are responsible to clean up afterwards.Yves Senn2014-02-131-82/+114
| | | | | | | | | | remove created state after test execution, not before the next test. This prevents the leak of the `ex` table outside of a single test.
* | used user-defined configurations for running tests that might depend on ↵Kuldeep Aggarwal2013-12-291-1/+2
| | | | | | | | user's system configuration
* | Tell how to Create a Database in Error Messageschneems2013-12-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently if you attempt to use a database that does not exist you get an error: ``` PG::ConnectionBad FATAL: database "db_error" does not exist ``` The solution is easy, create and migrate your database however new developers may not know these commands by memory. Instead of requiring the developer to search for a solution, tell them how to fix the problem in the error message: ``` ActiveRecord::NoDatabase: FATAL: database "db_error" does not exist Run `$ bin/rake db:create db:migrate` to create your database ``` Active Record should not know about `rake db:migrate` so this additional information needs to come from the railtie. Potential alternative implementation suggestions are welcome.
* | Fix PostgreSQL insert to properly extract table name from multiline string SQL.Kuldeep Aggarwal2013-12-191-0/+12
|/ | | | | | | | | | | | Previously, executing an insert SQL in PostgreSQL with a command like this: insert into articles( number) values( 5152 ) would not work because the adapter was unable to extract the correct articles table name.
* Remove deprecated SchemaStatements#distinctFrancesco Rodriguez2013-07-021-46/+0
|
* Merge pull request #10556 from Empact/deprecate-schema-statements-distinctRafael Mendonça França2013-05-121-12/+24
| | | | | | Deprecate SchemaStatements#distinct, and make SchemaStatements#columns_for_distinct nodoc. Conflicts: activerecord/CHANGELOG.md
* Fix that #exists? can produce invalid SQL: "SELECT DISTINCT DISTINCT"Ben Woosley2013-05-101-0/+34
| | | | | | | | | | | | The combination of a :uniq => true association and the #distinct call in #construct_limited_ids_condition combine to create invalid SQL, because we're explicitly selecting DISTINCT, and also sending #distinct on to AREL, via the relation#distinct_value. Rather than build a select distinct clause in #construct_limited_ids_condition, I set #distinct! and pass just the columns into the select statement. This requires introducing a #columns_for_distinct method to return the select columns but not the statement itself.
* Created a layer of abstraction for the valid type checking in schema dumper. ↵Ranjay Krishna2013-03-251-0/+9
| | | | Now, connection handles the check for valid types so that each database can handle the changes individually.
* Wrong exception is occured when raising no translatable exceptionkennyj2013-03-011-0/+6
|
* Revert "checking in the abstractions for valid type checking:"Jon Leighton2013-02-151-9/+0
| | | | | | | | | | | | | | | | This reverts commit c321b309a9a90bbfa0912832c11b3fef52e71840. Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb Reason: failing test 1) Error: test_valid_column(ActiveRecord::ConnectionAdapters::SQLite3AdapterTest): NoMethodError: undefined method `column' for test/cases/adapters/sqlite3/sqlite3_adapter_test.rb:29:in `test_valid_column'
* checking in the abstractions for valid type checking:Ranjay Krishna2013-02-121-0/+9
|
* Refactoring, testing and documenting pg_connection.distinctSemyon Perepelitsa2012-11-211-0/+29
|
* PostgreSQL, quote table names when fetching the primary key. Closes #5920Yves Senn2012-10-051-0/+4
|
* refactor configuration of insert_returningDoug Cole2012-04-071-19/+15
|
* pick better names and add a little documentationDoug Cole2012-04-011-8/+8
|
* improve test coverageDoug Cole2012-03-311-0/+26
|
* add use_returning as a postgresql connection configDoug Cole2012-03-311-0/+9
|
* Remove NULLS FIRST/LAST. closes #5152kennyj2012-02-251-0/+5
|