aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into adequaterecordAaron Patterson2014-02-264-90/+206
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (55 commits) [ci skip] Move association class method notes extract common code in `uuid_test.rb`. move PostgreSQL UUID tests from `datatype_test.rb` to `uuid_test.rb`. [ci skip] remove guide section on models in migrations test case for custom PostgreSQL enum type. Remove inclusion of rubysl gem for rbx on generated Gemfile let `insert_record` actuall save the object. [skip ci] Fix test name typo in app generator tests. travis s/2.1.0/2.1.1 Bump version of bcrypt gem Skip test_migrate_revert_add_index_with_name if databases do not allow to create duplicate indexes on the same columns Optimize getting started guide images, and use png instead of jpg :scissors: [ci skip] Point master changelogs to 4-1-stable branch Add missing parantheses in index_exists? `ActionDispatch::Head` was replaced by `Rack::Head`. Closes #14191. [skip ci] Standardized punctuation. [skip ci] Fix typo in link_to :method option description refactor, with_locale is not needed because I18n is mocked. Fix ActionView label translation for more than 10 nested elements ...
| * extract common code in `uuid_test.rb`.Yves Senn2014-02-261-60/+57
| |
| * move PostgreSQL UUID tests from `datatype_test.rb` to `uuid_test.rb`.Yves Senn2014-02-262-16/+36
| |
| * test case for custom PostgreSQL enum type.Yves Senn2014-02-261-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | This test currently outputs the following warning: ``` unknown OID: current_mood(3567879) (SELECT "postgresql_enums".* FROM "postgresql_enums" ORDER BY "postgresql_enums"."id" ASC LIMIT 1) unknown OID: current_mood(3567879) (SELECT "postgresql_enums".* FROM "postgresql_enums" WHERE "postgresql_enums"."id" = $1 LIMIT 1) ``` We have an open PR to deal with this issue. It will dynamically register the OID for enum columns. This test case is merely to exhibit the current behavior of PostgreSQL enum columns.
| * deprecate support for pg ranges with excluding beginnings.Yves Senn2014-02-231-23/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Ruby Range object does not support excluding beginnings. We currently support excluding beginnings for some subtypes using manually by incrementing them (now using the `#succ` method). This is approach is flawed as it's not equal to an excluding beginning. This commit deprecates the current support for excluding beginnings. It also raises an `ArgumentError` for subtypes that do not implement the `succ` method. This is a temporary solution to get rid of the broken state. We might still add complete support for excluding beginnings afterwards. (Probably with a new `PGRange` object, which acts like a `Range` but has excluding beginnings.
| * dynamically define PostgreSQL OID range types.Yves Senn2014-02-231-11/+40
| | | | | | | | | | | | | | | | This gets AR working with custom defined range types. It also removes the need for subtype specific branches in `OID::Range`. This expands the interface of all `OID` types with the `infinity` method. It's responsible to provide a value for positive and negative infinity.
* | Merge branch 'master' into adequaterecordAaron Patterson2014-02-181-0/+8
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (32 commits) Typo fix for unscope Use the reference for the mime type to get the format Preparing for 4.1.0.beta2 release Correctly escape PostgreSQL arrays. Escape format, negative_format and units options of number helpers Sync 4.1 release notes with changes since 7f648bc7 [ci skip] Update upgrading guide regarding `render :text` Add `#no_content_type` attribute to `AD::Response` Add missing CHANGELOG entry to Action View Update guides for new rendering options Cleanup `ActionController::Rendering` Fix a fragile test on `action_view/render` Introduce `render :html` for render HTML string Introduce `render :plain` for render plain text Update hash format for render_text_test Introduce `render :body` for render raw content Don't use `# =>` when it is not the expression values Fix the column name [ci skip] Document the default scopes change on the release notes, CHANGELOG and upgrating guides Move changelog entry to the top, fix examples indent [ci skip] ...
| * Merge branch '4-1-0-beta2'Rafael Mendonça França2014-02-181-0/+8
| |\ | | | | | | | | | | | | | | | Conflicts: actionview/CHANGELOG.md activerecord/CHANGELOG.md
| | * Correctly escape PostgreSQL arrays.Aaron Patterson2014-02-181-0/+8
| | | | | | | | | | | | | | | | | | Thanks Godfrey Chan for reporting this! Fixes: CVE-2014-0080
* | | Merge branch 'master' into adequaterecordAaron Patterson2014-02-171-0/+39
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: Revert "Merge pull request #13344 from ccutrer/fix-from-default-select" No need to use symbols Don't skip tests if they are not broken. Just don't define they Fix typo [ci skip] Resolve encoding issues with arrays of hstore (bug 11135). Fix coffeescript sample [ci skip]
| * | Resolve encoding issues with arrays of hstore (bug 11135).Josh Goodall2014-02-171-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We didn't have enough encoding for the wire protocol to store an array of hstore types. So, further encode any hstore that is an array member. Whilst we're here, ensure it's an HashWithIndifferentAccess being returned, to be consistent with other serialized forms, and add testing for arrays of hstore. So now the following migration: enable_extension "hstore" create_table :servers do |t| t.string :name t.hstore :interfaces, array: true end produces a model that can used like this, to store an array of hashes: server = Server.create(name: "server01", interfaces: [ { name: "bge0", ipv4: "192.0.2.2", state: "up" }, { name: "de0", state: "disabled", by: "misha" }, { name: "fe0", state: "up" }, ]) More at http://inopinatus.org/2013/07/12/using-arrays-of-hstore-with-rails-4/
* | | Merge branch 'master' into adequaterecordAaron Patterson2014-02-176-102/+210
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (311 commits) Add a missing changelog entry for #13981 and #14035 Revert "Fixed plugin_generator test" implements new option :month_format_string for date select helpers [Closes #13618] add factory methods for empty alias trackers guarantee a list in the alias tracker so we can remove a conditional stop exposing table_joins make most parameters to the AliasTracker required make a singleton for AssociationScope pass the association and connection to the scope method pass the tracker down the stack and construct it in the scope method clean up add_constraints signature remove the reflection delegate remove klass delegator remove railties changes. fixes #14054 remove chain delegate remove scope_chain delegate Add verb to sanitization note fix path shown in mailer's templates updated Travis build status image url fix guide active_support_core_extensions. add Note to String#indent [ci skip] ... Conflicts: activerecord/lib/active_record/associations/join_dependency.rb activerecord/test/cases/associations/association_scope_test.rb
| * | 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.
| * | Terminate the backend ourselves on PG 9.2+Matthew Draper2014-02-121-19/+29
| | | | | | | | | | | | This should make it harder to accidentally break this test.
| * | test case to illustrate current PostgreSQL composite behavior.Yves Senn2014-02-111-0/+42
| | |
| * | Adjust test value so that timezone has no effectAndrew White2014-02-071-1/+1
| | | | | | | | | | | | | | | | | | If the test is run in a timezone that is behind UTC it fails because the time generated is ahead of 0000-01-01 00:00:00. Just increase the time subtracted so that timezone has no effect.
| * | Merge pull request #13688 from jbaudanza/psql-index-existsRafael Mendonça França2014-02-011-0/+12
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL implementation of SchemaStatements#index_name_exists? Conflicts: activerecord/CHANGELOG.md
| | * | psql implementation of #index_name_exists?Jonathan Baudanza2014-01-161-0/+12
| | | |
| * | | Fixes issue with parsing whitespace content back from database - fixes #13907Mauricio Linhares2014-02-011-0/+12
| | | |
* | | | Merge branch 'master' into adequaterecordAaron Patterson2014-01-171-0/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | * master: fix exception translation translate exceptions on prepared statement failure test to ensure bad prepared statements raise a StatementInvalid exception
| * | | test to ensure bad prepared statements raise a StatementInvalid exceptionAaron Patterson2014-01-171-0/+6
| | | |
* | | | Merge branch 'master' into adequaterecordAaron Patterson2014-01-163-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: Make AR::Base#touch fire the after_commit and after_rollback callbacks Fix test for cache_key + touched Revert "methods are defined right after the module_eval, so we don't need to do" Revert "Don't remove trailing slash from PATH_INFO for mounted apps" Add failing test for #13369 reset column information after fiddling with `Encoding.default_internal` we have `with_env_tz` as global test helper. Remove duplicate. isolate class attribute assignment in `migration_test.rb` use `teardown` for cleanup, not `setup`. tests without transactional fixtures need to cleanup afterwards. no need to `return skip` in tests. `skip` is enough. methods are defined right after the module_eval, so we don't need to do any line number maths Get rid of unused TransactionError constant Avoid converting :on option to array twice when defining commit/rollback callbacks Unify changelog entries about single quotes [ci skip] Use single quotes in generated files
| * | | no need to `return skip` in tests. `skip` is enough.Yves Senn2014-01-163-3/+3
| |/ /
* / / match against bind valuesAaron Patterson2014-01-141-2/+2
|/ /
* | Make change_table use object of current database adapterNishant Modak2014-01-071-0/+17
| | | | | | | | | | | | | | | | | | - Earlier, change_table was creating database-agnostic object. - After this change, it will create correct object based on current database adapter. - This will ensure that create_table and change_table will get same objects. - This makes update_table_definition method public and nodoc. - Fixes #13577 and #13503
* | used user-defined configurations for running tests that might depend on ↵Kuldeep Aggarwal2013-12-291-1/+2
| | | | | | | | user's system configuration
* | Tidy up fix for PG extensions quotingCarlos Antonio da Silva2013-12-233-6/+18
| | | | | | | | | | Always pass in the column for quote_bound_value and quote using it in case it exists there.
* | Serialize postgres' hstore, json and array types correctly in AR update methods.Tadas Tamosauskas2013-12-233-0/+18
| | | | | | | | | | | | | | | | | | Fixes #12261. Closes #12395. Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/adapters/postgresql/array_test.rb activerecord/test/cases/adapters/postgresql/json_test.rb
* | Do not consider PG array columns as number or text columnsCarlos Antonio da Silva2013-12-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code uses these checks in several places to know what to do with a particular column, for instance AR attribute query methods has a branch like this: if column.number? !value.zero? end This should never be true for array columns, since it would be the same as running [].zero?, which results in a NoMethodError exception. Fixing this by ensuring that array columns in PostgreSQL never return true for number?/text? checks. Since most of the array support was based on the postgres_ext lib, it's worth noting it does the same thing for numeric array columns too: https://github.com/dockyard/postgres_ext/blob/v1.0.0/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb#L72 This extended the same logic for text columns to ensure consistency.
* | 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 quoting non-stringsDamien Mathieu2013-12-221-0/+6
| | | | | | | | Closes #13444
* | Fix indent in PG array testsCarlos Antonio da Silva2013-12-191-5/+5
| | | | | | | | [ci skip]
* | Merge pull request #13395 from kuldeepaggarwal/postgres-table-ref-regexCarlos Antonio da Silva2013-12-191-0/+12
|\ \ | | | | | | modified regex for finding table_name from a multiline sql query in postgresql
| * | 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.
* / Fix PostgreSQL range testsMatthew Draper2013-12-191-11/+11
|/ | | | The changes in c4044b2 meant the tests would error on a fresh DB.
* refactor, reuse assertions in range_test.rb.Yves Senn2013-12-131-186/+111
|
* extract PG range tests from datatype_test.rb into range_test.rbYves Senn2013-12-132-282/+320
|
* Don't skip tests if we don't need to.Rafael Mendonça França2013-11-086-420/+401
| | | | | | | We can conditional define the tests depending on the adapter or connection. Lets keep the skip for fail tests that need to be fixed.
* short arrays in inspectJan Bernacki2013-10-301-0/+5
|
* Merge pull request #12643 from severin/pg_cast_json_on_writeYves Senn2013-10-251-0/+7
|\ | | | | cast json values on write to be consistent with reading from the db.
| * cast json values on write to be consistent with reading from the db.Severin Schoepke2013-10-251-0/+7
| | | | | | | | See also commit 5ac2341fab689344991b2a4817bd2bc8b3edac9d
* | Merge pull request #12633 from senny/no_more_time_zone_leaksYves Senn2013-10-251-25/+15
|\ \ | |/ |/| prevent global timezone state from leaking out of test cases.
| * prevent global timezone state from leaking out of test cases.Yves Senn2013-10-251-25/+15
| |
* | `ActiveRecord::Store` works together with PG `hstore` columns.Yves Senn2013-10-251-0/+21
| | | | | | | | | | | | This is necessary because as of 5ac2341 `hstore` columns are always stored as `Hash` with `String` keys. `ActiveRecord::Store` expected the attribute to be an instance of `HashWithIndifferentAccess`, which led to the bug.
* | test to verify the `ActiveRecord::Store` behavior with PG's json typeYves Senn2013-10-251-0/+18
|/
* Dump the default function when the primary key is uuidRafael Mendonça França2013-10-141-2/+2
| | | | Fixes #12489
* log the statement name along with the SQLAaron Patterson2013-10-041-0/+10
|
* stop adding singleton methods to the mysql2 adapterAaron Patterson2013-10-041-15/+0
|
* stop adding singleton methods to the PG connectionAaron Patterson2013-10-041-11/+26
|
* Merge pull request #12315 from gaurish/superRafael Mendonça França2013-09-231-26/+28
|\ | | | | TypeError: superclass mismatch for class PostgreSQLAdapter