aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Session variables for mysql, mysql2, and postgresql adapters can be setAaron Stone2012-12-081-1/+16
| | | | | | | | | in the new 'variables:' hash in each database config section in database.yml. The key-value pairs of this hash will be sent in a 'SET key = value, ...' query on new database connections. The configure_connection methods from mysql and mysql2 into are consolidated into the abstract_mysql base class.
* #7914 Remove code for unsupported postgreSQL version.Arturo Pie2012-10-131-3/+0
| | | | | | | Remove parsing of character type default values for 8.1 formatting since Rails doesn't support postgreSQL 8.1 anymore. Remove misleading comment unrelated to code.
* #7914 Using a better way to get the defaults from db.Arturo Pie2012-10-131-1/+2
| | | | | | | | | According to postgreSQL documentation: (http://www.postgresql.org/docs/8.2/static/catalog-pg-attrdef.html) we should not be using 'adsrc' field because this field is unaware of outside changes that could affect the way that default values are represented. Thus, I changed the queries to use "pg_get_expr(adbin, adrelid)" instead of the historical "adsrc" field.
* #7914 get default value when type uses schema nameArturo Pie2012-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL adapter properly parses default values when using multiple schemas and domains. When using domains across schemas, PostgresSQL prefixes the type of the default value with the name of the schema where that type (or domain) is. For example, this query: ``` SELECT a.attname, d.adsrc FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = "defaults"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; ``` could return something like "'<default_value>'::pg_catalog.text" or "(''<default_value>'::pg_catalog.text)::text" for the text columns with defaults. I modified the regexp used to parse this value so that it ignores anything between ':: and \b(?:character varying|bpchar|text), and it allows to have optional parens like in the above second example.
* Fixed unclosing tagAvnerCohen2012-10-091-1/+1
|
* Support for specifying transaction isolation levelJon Leighton2012-09-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If your database supports setting the isolation level for a transaction, you can set it like so: Post.transaction(isolation: :serializable) do # ... end Valid isolation levels are: * `:read_uncommitted` * `:read_committed` * `:repeatable_read` * `:serializable` You should consult the documentation for your database to understand the semantics of these different levels: * http://www.postgresql.org/docs/9.1/static/transaction-iso.html * https://dev.mysql.com/doc/refman/5.0/en/set-transaction.html An `ActiveRecord::TransactionIsolationError` will be raised if: * The adapter does not support setting the isolation level * You are joining an existing open transaction * You are creating a nested (savepoint) transaction The mysql, mysql2 and postgresql adapters support setting the transaction isolation level. However, support is disabled for mysql versions below 5, because they are affected by a bug (http://bugs.mysql.com/bug.php?id=39170) which means the isolation level gets persisted outside the transaction.
* Merge pull request #7547 from danmcclain/pg-arraysRafael Mendonça França2012-09-161-9/+66
|\ | | | | Adds migration and type casting support for PostgreSQL Array datatype
| * Moves column dump specific code to a module included in AbstractAdapterDan McClain2012-09-141-9/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having column related schema dumper code in the AbstractAdapter. The code remains the same, but by placing it in the AbstractAdapter, we can then overwrite it with Adapter specific methods that will help with Adapter specific data types. The goal of moving this code here is to create a new migration key for PostgreSQL's array type. Since any datatype can be an array, the goal is to have ':array => true' as a migration option, turning the datatype into an array. I've implemented this in postgres_ext, the syntax is shown here: https://github.com/dockyard/postgres_ext#arrays Adds array migration support Adds array_test.rb outlining the test cases for array data type Adds pg_array_parser to Gemfile for testing Adds pg_array_parser to postgresql_adapter (unused in this commit) Adds schema dump support for arrays Adds postgres array type casting support Updates changelog, adds note for inet and cidr support, which I forgot to add before Removing debugger, Adds pg_array_parser to JRuby platform Removes pg_array_parser requirement, creates ArrayParser module used by PostgreSQLAdapter
* | Ensure disconnecting or reconnecting resets the transaction stateJon Leighton2012-09-151-2/+2
| |
* | Store the transaction number in the transaction objectJon Leighton2012-09-151-1/+0
|/ | | | This avoids us having to manually increment and decrement it.
* postgres, map scaled intervals to string datatype (#7518)Yves Senn2012-09-061-1/+1
|
* ActiveRecord support to PostgreSQL 9.2 JSON typeDickson S. Guedes2012-09-051-1/+12
| | | | | | | | | This implements the support to encode/decode JSON data to/from database and creating columns of type JSON using a native type [1] supported by PostgreSQL from version 9.2. [1] http://www.postgresql.org/docs/9.2/static/datatype-json.html
* Modularize postgresql adapterKonstantin Shabanov2012-09-051-985/+136
|
* Refactor AR::Result or inherits. Because we have redundant codes aboutkennyj2012-08-221-8/+1
|
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* Simulated & actual (manual/skipped) PostgreSQL auto-reconnection tests.Steve Jorgensen2012-07-161-0/+1
|
* Don't crash exception translation w/ nil result attribute.Steve Jorgensen2012-07-161-1/+1
| | | | | | Exception.result is nil when attempting a query after PostgreSQL disconnect, resulting in new exception: NoMethodError: undefined method `error_field' for nil:NilClass
* Merge pull request #6874 from robbkidd/rename_sequences_tooAaron Patterson2012-07-101-0/+7
|\ | | | | Rename default sequence when table is renamed? [AR:postgres]
| * Update psql adapter to rename a default pkey sequence when renaming a table.Robb Kidd2012-06-271-0/+7
| |
* | Unify the collation API for the database adptersRafael Mendonça França2012-07-011-4/+4
| |
* | Support collate and ctype on the PostgreSQL.kennyj2012-06-291-1/+20
|/
* Allow precision option for postgresql datetimesTony Schneider2012-06-221-0/+10
| | | | | | | | | | This patch addresses the difficulty of retrieving datetime fields. By default, the database holds a higher precision than the time as a String. This issue is discussed at length at the following links: - [#3519](https://github.com/rails/rails/issues/3519) - [#3520](https://github.com/rails/rails/issues/3520) Also, kudos to @mattscilipoti
* Change minimum (default) log level in PostgreSQL to warning.kennyj2012-06-181-1/+1
|
* Add uuid type support to PostgreSQL adapterKonstantin Shabanov2012-06-141-3/+7
|
* Merge pull request #6477 from steveklabnik/close_discovered_pg_connectionRafael Mendonça França2012-05-301-1/+2
|\ | | | | Properly discover a connection is closed in postgresql_adapter
| * Properly discover a connection is closed in postgresql_adapterSteve Klabnik2012-05-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | PQstatus doesn't properly test if future operations will succeed. A PQping function is added to libpq in PostgreSQL 9.1, but if we rely on it, everyone on earlier versions of Postgres is out of luck, and the pg gem wouldn't have the 'fix' until the next release. Thanks to @cbrecabarren and @ged for handling all the dirty details. Closes #3392.
* | Merge pull request #6386 from kennyj/fix_logs_name_consistencyAaron Patterson2012-05-301-6/+5
|\ \ | | | | | | Fix logs name consistency.
| * | Fix logs name consistency.kennyj2012-05-191-6/+5
| | |
* | | Merge pull request #5872 from evtuhovich/prepared_statement_fixAaron Patterson2012-05-251-10/+10
|\ \ \ | |_|/ |/| | Remove prepared statement from system query in postgresql adapter
| * | Remove prepared statement from system query in postgresql adapterIvan Evtukhovich2012-05-121-10/+10
| | |
* | | Whitespaces :scissors:Rafael Mendonça França2012-05-231-1/+1
| | |
* | | PGconn doesn't accepts :checkout_timeout option.Rafael Mendonça França2012-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | This option was added on cb6f839359bd894feb0a1105b79af72b336aa41e renaming the :wait_timeout option. Fix build http://travis-ci.org/#!/rails/rails/jobs/1413405
* | | Fix a problem of translate_exception method in Japanese.kennyj2012-05-201-3/+7
| |/ |/|
* | Merge pull request #6238 from pwnall/pgsql_bytea_limitAaron Patterson2012-05-171-8/+19
|\ \ | | | | | | Postgresql doesn't accept limits on binary (bytea) columns.
| * | Postgresql doesn't accept limits on binary (bytea) columns.Victor Costan2012-05-091-8/+19
| |/
* | Removes NetAddr dependencyDan McClain2012-05-081-6/+7
| |
* | Converts inet and cidr columns to NetAddr::CIDRDan Seaver2012-05-071-0/+28
| |
* | Adds migration and schema dump support for INET, CIDR, and MACADDRDan Seaver2012-05-051-4/+23
|/
* Merge pull request #3713 from kf8a/masterAaron Patterson2012-05-041-2/+7
|\ | | | | postgresql adapter should quote not a number and infinity correctly for float columns
| * postgresql adapter handles quoting of not a number (NaN) and InfinitySven Bohm2011-11-211-2/+7
| |
* | Use arel nodes instead of raw sqlMarcelo Silveira2012-05-021-1/+4
| |
* | Merge pull request #5698 from dougcole/support_postgresql_partitioningAaron Patterson2012-04-271-6/+41
|\ \ | | | | | | Support postgresql partitioning by making INSERT RETURNING optional
| * | refactor configuration of insert_returningDoug Cole2012-04-071-14/+4
| | |
| * | pick better names and add a little documentationDoug Cole2012-04-011-8/+16
| | |
| * | refactorDoug Cole2012-03-311-13/+8
| | |
| * | add use_returning as a postgresql connection configDoug Cole2012-03-311-4/+46
| | |
* | | Restore .to_s to escape_hstoreRyan Fitzgerald2012-04-241-1/+1
| | |
* | | Always quote hstore keys and valuesRyan Fitzgerald2012-04-241-2/+1
|/ / | | | | | | | | | | | | escape_hstore uses quotation marks around keys and values only if it seems necessary. However, it currently breaks in the presence of some non-ASCII characters. Instead of trying to guess exactly which characters are safe, it seems better to always use quotes.
* | Fix GH #5430. A Payload name for schema_search_path should be SCHEMA.kennyj2012-03-151-1/+1
| |
* | Adds #create/drop_schema on the PostgreSQL Adapter.Travis Jeffery2012-03-071-0/+10
| |