aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql
diff options
context:
space:
mode:
authorArturo Pie <arturop@nulogy.com>2012-10-12 18:03:30 -0400
committerArturo Pie <arturotd08@yahoo.ca>2012-10-13 19:41:50 -0400
commit2da85edda36692c882ff25ccf7dbd038de2f771c (patch)
tree3481f465762bf370d2c14140b0348cb367f02178 /activerecord/test/cases/adapters/postgresql
parent7cc6ee75b6ad2d3959400253604f96a7fcb93ab8 (diff)
downloadrails-2da85edda36692c882ff25ccf7dbd038de2f771c.tar.gz
rails-2da85edda36692c882ff25ccf7dbd038de2f771c.tar.bz2
rails-2da85edda36692c882ff25ccf7dbd038de2f771c.zip
#7914 get default value when type uses schema name
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.
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql')
-rw-r--r--activerecord/test/cases/adapters/postgresql/schema_test.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb
index ffbf14b528..cd31900d4e 100644
--- a/activerecord/test/cases/adapters/postgresql/schema_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb
@@ -72,7 +72,7 @@ class SchemaTest < ActiveRecord::TestCase
end
def test_schema_names
- assert_equal ["public", "test_schema", "test_schema2"], @connection.schema_names
+ assert_equal ["public", "schema_1", "test_schema", "test_schema2"], @connection.schema_names
end
def test_create_schema