aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Made schema dumper recognize partial indices' where statementsMarcelo Silveira2012-02-091-0/+6
|
* remove table quoting in primary_key methodPaul Gallagher2011-06-111-0/+30
| | | * add/cleanup tests
* apply private method indentation conventionPaul Gallagher2011-06-101-1/+1
| | | * tidy test code and fix my typo
* Improve PostgreSQL adapter schema-awarenessPaul Gallagher2011-06-101-0/+39
| | | | | | | * table_exists? scoped by schema search path unless schema is explicitly named. Added tests and doc to clarify the behaviour * extract_schema_and_table tests and implementation extended to cover all cases * primary_key does not ignore schema information * add current_schema and schema_exists? methods * more robust table referencing in insert_sql and sql_for_insert methods
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* use index based substitution for bind parametersAaron Patterson2011-04-131-3/+3
|
* wrap the pg_get_serial_sequence function and reuse it for the default ↵Aaron Patterson2011-04-111-0/+25
| | | | sequence name
* adding exec_insert for postgresqlAaron Patterson2011-04-111-1/+37
|
* renaming exec in the PG adapterAaron Patterson2010-11-051-9/+9
|
* bind substitution is working properlyAaron Patterson2010-10-261-0/+8
|
* bind parameters are now typecastAaron Patterson2010-10-261-0/+14
|
* basic bind parameters are workingAaron Patterson2010-10-261-0/+12
|
* initial exec() method is working in pg adapterAaron Patterson2010-10-261-0/+17
|
* Let's initialize instance variables in the postgres adapter.Aaron Patterson2010-07-141-0/+17