aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql
Commit message (Collapse)AuthorAgeFilesLines
* PostgreSQL, adapter automatically reloads it's type map. Closes #14678.Yves Senn2014-04-114-6/+28
| | | | [Yves Senn & Matthew Draper]
* Remove warning of unused variableRafael Mendonça França2014-04-101-1/+1
|
* Use connection-specific bytea escapingMatthew Draper2014-04-081-0/+17
| | | | | | | | | | In our normal usage, it's rare for this to make a difference... but is more technically correct. As well as a spec that proves this is a good idea, let's also add a more sane-looking one that just covers basic to_sql functionality. There aren't many places where we actually use escape_bytea, but that's one that won't be going away.
* Merge pull request #14579 from senny/pg/remove_string_limitRafael Mendonça França2014-04-041-1/+1
|\ | | | | | | | | | | | | PostgreSQL, remove varchar limit. Conflicts: activerecord/CHANGELOG.md
| * PostgreSQL and SQLite, remove varchar limit. [Vladimir Sazhin & Toms Mikoss ↵Yves Senn2014-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | & Yves Senn] There is no reason for the PG adapter to have a default limit of 255 on :string columns. See this snippet from the PG docs: Tip: There is no performance difference among these three types, apart from increased storage space when using the blank-padded type, and a few extra CPU cycles to check the length when storing into a length-constrained column. While character(n) has performance advantages in some other database systems, there is no such advantage in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs. In most situations text or character varying should be used instead.
* | Prevent state leak in test.Guo Xiang Tan2014-04-031-17/+16
|/ | | | This will allow us to run the tests in random order.
* Merge pull request #14561 from tgxworld/refactor_run_without_connectionYves Senn2014-04-034-26/+17
|\ | | | | Add ConnectionHelper to refactor tests.
| * Add ConnectionHelper to refactor tests.Guo Xiang Tan2014-04-034-26/+17
| |
* | Treat blank UUID values as nilDmitry Lavrov2014-04-031-0/+5
|/
* PostgreSQL, Support for materialized views. [Dave Lee & Yves Senn]Dave Lee2014-04-021-8/+26
| | | | | Expand the query used in #table_exists? to include materialized views in the kinds of relations it searches.
* cleanup, `reset_pg_session` in range_test.rbYves Senn2014-04-021-2/+5
| | | | | Also do not use transactional fixtures. We drop the type and the table after every run, so there is nothing for the transaction to clean up.
* Allow postgresql enum_test to be run in random order.Guo Xiang Tan2014-04-012-9/+13
| | | | Creating and dropping similar tables within the same connection causes postgresql to look up old values in the cache of tables which have already been dropped.
* PostgreSQL, register custom domains. Closes #14305.Yves Senn2014-04-011-0/+53
| | | | | | | This patch registers custom domains in our OID-type_map. They will behave exactly as the type specified by `pg_type.typbasetype`. /cc @matthewd
* PostgreSQL determine `Column#type` through corresponding OID. #7814Yves Senn2014-04-012-4/+3
| | | | | | | | | | | | | I ran the whole test suite and compared the old to the new types. Following is the list of types that did change with this patch: ``` DIFFERENT TYPE FOR mood: NEW: enum, BEFORE: DIFFERENT TYPE FOR floatrange: NEW: floatrange, BEFORE: float ``` The `floatrange` is a custom type. The old type `float` was simply a coincidence form the name `floatrange` and our type-guessing.
* fix bug on non empty defaults for pg array columnsLuke Steensen2014-03-301-0/+11
| | | | fixes #10613
* Fix tests not unsubscribing from Notifications.Guo Xiang Tan2014-03-281-2/+2
| | | | See https://github.com/rails/rails/blob/master/activesupport/lib/active_support/notifications.rb#L131
* PostgreSQL, use `PostgreSQLColumn` in PG specific tests.Yves Senn2014-03-281-8/+8
|
* PostgreSQL, test-cases to lock down column default values.Yves Senn2014-03-283-0/+33
|
* PostgreSQL, test cases to lock the current column types.Yves Senn2014-03-288-15/+68
|
* only run citext_test if the connection supports_extensions?.Yves Senn2014-03-271-52/+54
| | | | This will keep the test suite passing with older PG installations.
* 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.
* Teach PostgreSQLAdapter#reset! to actually resetMatthew Draper2014-03-181-0/+31
| | | | It wasn't doing anything beyond clearing the statement cache.
* Use teardown helper method.Guo Xiang Tan2014-03-1415-15/+15
| | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order.
* `change_table` supports `citext`. Follow up to #12523.Yves Senn2014-03-111-8/+27
|
* register OID for PostgreSQL citex datatype [Troy Kruthoff & Lachlan Sylvester]lsylvester2014-03-111-0/+58
| | | | citext makes it possible to use AR Hash finders for case-insensitive matching as sql UPPER/LOWER functions are not needed.
* Inline block to fix indent [ci skip]Carlos Antonio da Silva2014-03-041-3/+1
|
* Fix enum test unused variable warning.Vipul A M2014-03-041-1/+1
| | | | Related - https://github.com/rails/rails/commit/5c55aafd38f45ac019573f98438ffdbdc8c580f9
* Add Enum type to postgresql adapter's oids to prevent unknown OID warnings.Dieter Komendera2014-03-041-0/+28
|
* Fix warnings due to:Vipul A M2014-03-031-1/+1
| | | | | - unused variable in PG Adapter. - Ambiguous argument warning from range_test for use - to + Infinity range without brackets.
* 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 '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
* | 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/
* | 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
| | |
* | | test to ensure bad prepared statements raise a StatementInvalid exceptionAaron Patterson2014-01-171-0/+6
| | |
* | | no need to `return skip` in tests. `skip` is enough.Yves Senn2014-01-163-3/+3
|/ /
* | 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.