Project

General

Profile

Actions

Bug #1316

closed

Postgres DB Error while run rake db:migrate

Added by Florian Koch about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,

i use postgres 9.1 and puppet 2.7.6 with storeconfigs on sl6.1.

after setting all up i run

RAILS_ENV=production rake db:migrate

and get

-- add_column(:host_classes, :id, :primary_key)
NOTICE:  ALTER TABLE will create implicit sequence "host_classes_id_seq" for serial column "host_classes.id" 
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "host_classes_pkey" for table "host_classes" 
   -> 0.0124s
==  CreateHostClass: migrated (0.0130s) =======================================

==  AddSuseTemplates: migrating ===============================================
==  AddSuseTemplates: migrated (0.0210s) ======================================

rake aborted!
An error has occurred, this and all later migrations canceled:

PGError: ERROR:  current transaction is aborted, commands ignored until end of transaction block
: INSERT INTO schema_migrations (version) VALUES ('20110725142054')
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:520:in `execute'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `insert_sql'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:44:in `insert_without_query_dirty'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `insert'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:467:in `insert'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:550:in `record_version_state_after_migrating'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:492:in `migrate'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:565:in `call'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:565:in `ddl_transaction'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:565:in `ddl_transaction'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:490:in `migrate'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:477:in `each'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:477:in `migrate'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:401:in `up'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'
/usr/share/foreman/vendor/rails/railties/lib/tasks/databases.rake:112
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:635:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:635:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:630:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:630:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:589:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:582:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2050:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2028:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2028:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2028:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2022:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2067:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1997:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

if i run the command again , it complete without errors.

rgds f0

Actions #1

Updated by Ohad Levy about 13 years ago

  • Target version changed from 1.0 to 0.4.1
Actions #2

Updated by Florian Koch about 13 years ago

Here are more informations from the postgresql log

ERROR:  relation "settings" does not exist at character 245
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 = '"settings"'::regclass
                       AND a.attnum > 0 AND NOT a.attisdropped
                     ORDER BY a.attnum

ERROR:  relation "roles" does not exist at character 245
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 = '"roles"'::regclass
                       AND a.attnum > 0 AND NOT a.attisdropped
                     ORDER BY a.attnum

ERROR:  relation "usergroup_members" does not exist at character 245
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 = '"usergroup_members"'::regclass
                       AND a.attnum > 0 AND NOT a.attisdropped
                     ORDER BY a.attnum

ERROR:  relation "usergroups" does not exist at character 245
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 = '"usergroups"'::regclass
                       AND a.attnum > 0 AND NOT a.attisdropped
                     ORDER BY a.attnum

ERROR:  relation "users" does not exist at character 245
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 = '"users"'::regclass
                       AND a.attnum > 0 AND NOT a.attisdropped
                     ORDER BY a.attnum
ERROR:  column "operatingsystem_id" of relation "media" does not exist at character 66
STATEMENT:  INSERT INTO "media" ("name", "created_at", "updated_at", "path", "operatingsystem_id") VALUES('OpenSuSE mirror', '2011-12-02 11:21:39.979076', '2011-12-02 11:21:39.979076', 'http://mirror.isoc.org.il/pub/opensuse/distribution/$major.$minor/repo/oss', NULL) RETURNING "id" 
ERROR:  current transaction is aborted, commands ignored until end of transaction block
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'
                    AND dep.refobjid      = '"schema_migrations"'::regclass

ERROR:  current transaction is aborted, commands ignored until end of transaction block
STATEMENT:  INSERT INTO schema_migrations (version) VALUES ('20110725142054')
Actions #3

Updated by Ohad Levy almost 13 years ago

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

Also available in: Atom PDF