Project

General

Profile

Bug #1568

PG::Error on fresh install

Added by Florian Koch about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Hi, i have set up a fresh server and try to setup the Database

Got this error:

[root@foremana01 foreman]# RAILS_ENV=production bundle exec rake db:migrate --trace
/usr/share/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:10: warning: already initialized constant ENC_NONE
/usr/share/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:11: warning: already initialized constant ENC_EUC
/usr/share/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:12: warning: already initialized constant ENC_SJIS
/usr/share/foreman/vendor/ruby/1.8/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:13: warning: already initialized constant ENC_UTF8
  • Invoke db:migrate (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute db:migrate
    CreateMedia: migrating ==================================================
    -- create_table(:media)
    NOTICE: CREATE TABLE will create implicit sequence "media_id_seq" for serial column "media.id"
    NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "media_pkey" for table "media"
    -> 0.0238s
    rake aborted!
    An error has occurred, this and all later migrations canceled:

PG::Error: ERROR: current transaction is aborted, commands ignored until end of transaction block
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"media"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:207:in `log'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/postgresql_adapter.rb:501:in `query'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/postgresql_adapter.rb:1030:in `column_definitions'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/postgresql_adapter.rb:680:in `columns'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:685:in `columns'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/persistence.rb:295:in `attributes_from_column_definition'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/locking/optimistic.rb:62:in `attributes_from_column_definition'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:1400:in `initialize'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:502:in `new'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/base.rb:502:in `create'
/usr/share/foreman/db/migrate/20090717025820_create_media.rb:9:in `up_without_benchmarks'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:314:in `send'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:314:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:314:in `migrate'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:397:in `__send__'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:397:in `migrate'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:539:in `migrate'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:613:in `call'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:613:in `ddl_transaction'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:207:in `transaction'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:613:in `ddl_transaction'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:538:in `migrate'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:525:in `each'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:525:in `migrate'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:435:in `up'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/migration.rb:417:in `migrate'
/usr/share/foreman/vendor/ruby/1.8/gems/activerecord-3.0.10/lib/active_record/railties/databases.rake:151
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/share/foreman/vendor/ruby/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/share/foreman/vendor/ruby/1.8/bin/rake:19:in `load'
/usr/share/foreman/vendor/ruby/1.8/bin/rake:19
Tasks: TOP => db:migrate


Related issues

Is duplicate of Foreman - Bug #1545: Rails DB migration fails on PosgreSQL 9.1Duplicate2012-03-22

Associated revisions

Revision 2e291eb2 (diff)
Added by Ohad Levy about 7 years ago

fixes #1568 - PG::Error on fresh install

History

#1 Updated by Florian Koch about 7 years ago

Here is the postgres log

ERROR:  relation "media" does not exist at character 190
STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
        FROM pg_attribute a LEFT JOIN pg_attrdef d
        ON a.attrelid = d.adrelid AND a.attnum = d.adnum
        WHERE a.attrelid = '"media"'::regclass
        AND a.attnum > 0 AND NOT a.attisdropped
        ORDER BY a.attnum
        ;
ERROR:  relation "media" does not exist at character 190
STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
        FROM pg_attribute a LEFT JOIN pg_attrdef d
        ON a.attrelid = d.adrelid AND a.attnum = d.adnum
        WHERE a.attrelid = 'media'::regclass
        AND a.attnum > 0 AND NOT a.attisdropped
        ORDER BY a.attnum
        ;
ERROR:  column "media" does not exist at character 190
STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
        FROM pg_attribute a LEFT JOIN pg_attrdef d
        ON a.attrelid = d.adrelid AND a.attnum = d.adnum
        WHERE a.attrelid = media::regclass
        AND a.attnum > 0 AND NOT a.attisdropped
        ORDER BY a.attnum
        ;
ERROR:  column "media" does not exist at character 190
STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
        FROM pg_attribute a LEFT JOIN pg_attrdef d
        ON a.attrelid = d.adrelid AND a.attnum = d.adnum
        WHERE a.attrelid = media::regclass
        AND a.attnum > 0 AND NOT a.attisdropped
        ORDER BY a.attnum
        ;
ERROR:  relation "user_notices" does not exist at character 580
STATEMENT:            SELECT attr.attname, seq.relname
                  FROM pg_class      seq,
                       pg_attribute  attr,
                       pg_depend     dep,
                       pg_namespace  name,
                       pg_constraint cons
                  WHERE seq.oid           = dep.objid
                    AND seq.relkind       = 'S'
                    AND attr.attrelid     = dep.refobjid
                    AND attr.attnum       = dep.refobjsubid
                    AND attr.attrelid     = cons.conrelid
                    AND attr.attnum       = cons.conkey[1]
                    AND cons.contype      = 'p'
:

#2 Updated by Ohad Levy about 7 years ago

  • Assignee set to Ohad Levy

#3 Updated by Ohad Levy about 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

#4 Updated by Florian Koch about 7 years ago

Hi,

i can confirm the fix,

regards Florian

Also available in: Atom PDF