aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* Make change_table use object of current database adapterNishant Modak2014-01-071-5/+5
| | | | | | | | | - 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
* Do not consider PG array columns as number or text columnsCarlos Antonio da Silva2013-12-231-1/+9
| | | | | | | | | | | | | | | | | | | | | | | 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/+6
| | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | 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.
* support creating temporary tables from queriesCody Cutrer2013-12-141-2/+2
| | | | | also override drop_table in AbstractMySQLAdapter to properly drop temporary tables without committing the transaction
* fix pg warnings on geometric typesAaron Patterson2013-12-051-10/+23
|
* make the type_map per connection. fixes #13182Aaron Patterson2013-12-041-11/+16
|
* Drop a sqlite_version check because we only support SQLite 3.6.16 or newer.Ben Woosley2013-11-121-1/+0
| | | Drop some comments that document the implementation rather than the interface.
* Don't use Active Support where we don't need toRafael Mendonça França2013-11-091-1/+1
|
* log bind variables after they were type casted.Yves Senn2013-11-091-4/+5
| | | | | | | | | | | | | | | The log output used to be confusing in situation where type casting has "unexpected" effects. For example when finding records with a `String`. BEFORE: irb(main):002:0> Event.find("im-no-integer") D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- : Event Load (4.5ms) SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1 [["id", "im-no-integer"]] AFTER: irb(main):002:0> Event.find("im-no-integer") D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- : Event Load (4.5ms) SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1 [["id", 0]]
* `ActiveRecord::Store` works together with PG `hstore` columns.Yves Senn2013-10-251-0/+4
| | | | | | 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.
* Escape the parentheses in the default function regexpRafael Mendonça França2013-10-211-1/+1
| | | | | | | This is causing every default value in PostreSQL database to being handled as default function. Fixes #12581
* Extract a function to determine if the default value is a functionRafael Mendonça França2013-10-141-1/+5
|
* Push default_function to superclass to avoid method checkRafael Mendonça França2013-10-141-3/+5
|
* log the statement name along with the SQLAaron Patterson2013-10-041-1/+1
|
* log every sql statement, even when they errorAaron Patterson2013-10-041-25/+25
|
* prepare the statement inside the begin / rescue blockAaron Patterson2013-10-041-4/+4
|
* wrap logging around the actual query call itself.Aaron Patterson2013-10-041-25/+29
| | | | This is to be consistent with the way the mysql2 adapter times queries
* extract adapter savepoint implementations into `abstract/savepoints.rb`.Yves Senn2013-09-301-5/+1
|
* Merge pull request #11382 from kennyj/fix_10751-2Rafael Mendonça França2013-09-221-3/+6
|\ | | | | | | | | | | | | Dump UUID default functions to schema.rb [2nd version]. Fixes #10751. Conflicts: activerecord/CHANGELOG.md
| * Migration dump UUID default functions to schema.rb. Fixes #10751.kennyj2013-07-101-3/+6
| |
* | Check if the SQL is not a prepared statementRafael Mendonça França2013-09-111-0/+1
| | | | | | | | | | | | | | | | | | When the adapter is with prepared statement disabled and the binds array is not empty the connection adapter will try to set the binds values and will fail. Now we are checking if the adapter has the prepared statement disabled. Fixes #12023
* | cast hstore values on write to be consistent with reading from the db.Yves Senn2013-08-081-0/+8
| |
* | Removed redundant xml override from pg adapterPaul Nikitochkin2013-08-021-7/+3
|/ | | | Closes: #11706
* Handle single quotes in PostgreSQL default column valuesDylan Markow2013-06-191-1/+1
| | | | | | | | | | PostgreSQL escapes single quotes by using an additional single quote. When Rails queries the column information, PostgreSQL returns the default values with the escaped single quotes. #extract_value_from_default now converts these to one single quote each. Fixes #10881.
* Also support extensions in PostgreSQL 9.1, because this has been supported ↵kennyj2013-05-151-4/+4
| | | | since 9.1.
* Revert "Merge pull request #10455 from ↵Aaron Patterson2013-05-071-6/+2
| | | | | | | patricksrobertson/bigserial_id_not_identifying_pk" This reverts commit 3043d45eefc3776d5f3a9e7d212a01f99d869ef8, reversing changes made to ca0275d36b395631725c4583db5a45c06443fdb9.
* Handle other pk types in PostgreSQL gracefully.Patrick Robertson2013-05-071-2/+6
| | | | | | | | | | | | | | In #10410 it was noted that you can no longer create PK's with the type of bigserial in PostgreSQL in 4.0.0.rc1. This is mostly because the newer adapter is checking for column type with the id column instead of just letting it pass through like it did before. Side effects: You may just create a PK column of a type that you really don't want to be your PK. As far as I can tell this was allowed in 3.2.X and perhaps an exception should be raised if you try and do something extremely dumb.
* Changing method call according to coding conventionsAkshay Khole2013-05-051-1/+1
|
* Add parameter :sslcompression to PostgreSQL adapter.Lars Kanis2013-05-021-2/+2
| | | | It is new in PostgreSQL-9.2 .
* Improve docs for postgresql with uuid primary keys [ci skip]Carlos Antonio da Silva2013-05-011-8/+7
| | | | Introduced in 09ac1776abc0d3482f491f2d49f47bcb3d9a4ad7.
* allow override of uuid_generate_v4() default by passing default: nilChad Moone2013-05-011-1/+30
| | | | without this, it's not possible to use UUID primary keys without uuid-ossp installed and activated
* Correctly parse bigint defaults in PostgreSQLErik Peterson2013-04-051-1/+1
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2013-03-301-2/+2
|\ | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb activerecord/test/cases/adapter_test.rb guides/source/testing.md [ci skip]
| * nodoc AR::ConnectionHandling for adapters [ci skip]Francesco Rodriguez2013-03-151-2/+2
| |
* | Adds support for concurrent indexing in PostgreSQL adapterDan McClain2013-03-251-0/+4
| | | | | | | | | | | | | | | | Adds support for algorithm option in MySQL indexes Moves USING and algorithm options upstream The syntax is still specific to the Adapter, so the actual executed string happens in the corresponding adapter
* | Make Postgres point type correspond to ruby array with two floats insideMartin Schürrer2013-03-251-1/+8
| |
* | Created a layer of abstraction for the valid type checking in schema dumper. ↵Ranjay Krishna2013-03-251-0/+4
| | | | | | | | Now, connection handles the check for valid types so that each database can handle the changes individually.
* | add uuid primary key supportAaron Patterson2013-03-221-0/+7
| |
* | pull add_column_options! off the pg connection classAaron Patterson2013-03-221-13/+0
| |
* | push SQL generation inside the schema creation objectAaron Patterson2013-03-221-2/+2
| |
* | mostly decouple TableDefinition from the database connectionAaron Patterson2013-03-221-1/+1
| |
* | decouple column definition from the database connectionAaron Patterson2013-03-221-2/+2
| |
* | use `connect_poll` on pg so that reaping does not hurt the connectionAaron Patterson2013-03-201-2/+1
| |
* | you can provide uuid_generate_v4 as the default value for uuid columnsAaron Patterson2013-03-141-1/+7
| |
* | pg is the only adapter that supports the xml type, so push the method downAaron Patterson2013-03-141-0/+4
| |
* | extract factory method and push common code up to abstract adapterAaron Patterson2013-03-141-5/+2
| |
* | Also quote extension name in disable_extensionStephen Touset2013-03-121-1/+1
| | | | | | A patch was committed recently which quoted the extension name in the SQL for `enable_extension`. But the same wasn't done for `disable_extension`.
* | fixes enable_extension bug in postgresql_adapterDarren Woodley2013-03-081-1/+1
|/ | | | | | | | | The use of quotations is required to install extensions with certain characters in them (e.g. uuid-ossp). removes CHANGELOG entry Deemed unnecessary.
* Unprepared Visitor + unprepared_statementCédric FABIANSKI2013-03-081-1/+1
|