diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-01-30 12:06:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 12:06:44 -0500 |
commit | eda7f26b7265d6de2b5fba718a93fd78a735b6b5 (patch) | |
tree | 074d20de4227d2a84efd31da329fd7092e2e518a /activerecord/lib | |
parent | 6bf6957137842015c8dff1a2f39a23aec54f41c6 (diff) | |
parent | f9c6cbd55c56de7994b74630acd141c324411719 (diff) | |
download | rails-eda7f26b7265d6de2b5fba718a93fd78a735b6b5.tar.gz rails-eda7f26b7265d6de2b5fba718a93fd78a735b6b5.tar.bz2 rails-eda7f26b7265d6de2b5fba718a93fd78a735b6b5.zip |
Merge pull request #27743 from jordanlewis/simplify-postgres-column-definitions
Simplify query in column_definitions() for Postgres
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 0ebd907cc0..315d70c33f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -759,11 +759,11 @@ module ActiveRecord query(<<-end_sql, "SCHEMA") SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, - (SELECT c.collname FROM pg_collation c, pg_type t - WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation), - col_description(a.attrelid, a.attnum) AS comment - FROM pg_attribute a LEFT JOIN pg_attrdef d - ON a.attrelid = d.adrelid AND a.attnum = d.adnum + c.collname, col_description(a.attrelid, a.attnum) AS comment + FROM pg_attribute a + LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum + LEFT JOIN pg_type t ON a.atttypid = t.oid + LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum |