Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: relation "postgres_partitions" does not exist at character 454 #2283

Open
tkyoga opened this issue Jan 7, 2021 · 23 comments
Open

ERROR: relation "postgres_partitions" does not exist at character 454 #2283

tkyoga opened this issue Jan 7, 2021 · 23 comments

Comments

@tkyoga
Copy link

tkyoga commented Jan 7, 2021

I've upgraded gitlab(13.4.3->13.7.1) , I got following error.

2021-01-07 16:03:58.707 JST [1] LOG:  database system is ready to accept connections
2021-01-07 16:04:30.951 JST [1717] ERROR:  relation "postgres_partitions" does not exist at character 454
2021-01-07 16:04:30.951 JST [1717] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
	       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
	       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 = '"postgres_partitions"'::regclass
	   AND a.attnum > 0 AND NOT a.attisdropped
	 ORDER BY a.attnum

How do I fix?

@youuri
Copy link

youuri commented Mar 5, 2021

I got exactly the same when upgrading.

@iliyahristov
Copy link

Any progress ?

@kkimurak
Copy link
Contributor

kkimurak commented Mar 8, 2021

  1. I found some similar issues already closed, e.g. Postgresql errors during startup #1771 . Did you check them?

  2. Is your PostgreSQL version correct? Since GitLab 13.7, PostgreSQL 12.x is required as mentioned in README.
    If you're using non-suitable version, please follow upgrade instruction. Discussions in Upgrade to 13.7.0 #2275 may helps you.

best,

@sattellite
Copy link

@tkyoga and @iliyahristov do you have found any solution?

@das-korn
Copy link

das-korn commented Mar 20, 2021

Facing the same issue when upgrading 12.10.6-1 -> 13.9.4

PostgreSQL: 12-20200524

Edit:
I tested some versions in between. Updates works for 13.5.4 but then fails for 13.5.4->13.6.3

Logs:

gitlab_1      | Loading /etc/docker-gitlab/runtime/env-defaults
gitlab_1      | Initializing logdir...
gitlab_1      | Initializing datadir...
gitlab_1      | Installing configuration templates...
gitlab_1      | Configuring gitlab...
gitlab_1      | Configuring gitlab::database.
gitlab_1      | Configuring gitlab::redis
gitlab_1      | Configuring gitlab::secrets...
gitlab_1      | Configuring gitlab::sidekiq...
gitlab_1      | Configuring gitlab::gitaly...
gitlab_1      | Configuring gitlab::monitoring...
gitlab_1      | Configuring gitlab::gitlab-workhorse...
gitlab_1      | Configuring gitlab::puma...
gitlab_1      | Configuring gitlab::timezone...
gitlab_1      | Configuring gitlab::rack_attack...
gitlab_1      | Configuring gitlab::ci...
gitlab_1      | Configuring gitlab::artifacts...
gitlab_1      | Configuring gitlab::lfs...
gitlab_1      | Configuring gitlab::uploads...
gitlab_1      | Configuring gitlab::mattermost...
gitlab_1      | Configuring gitlab::project_features...
redis_1       | 1:C 20 Mar 2021 20:00:02.648 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
postgresql_1  | Initializing datadir...
postgresql_1  | Initializing certdir...
postgresql_1  | Initializing logdir...
postgresql_1  | Initializing rundir...
postgresql_1  | Setting resolv.conf ACLs...
postgresql_1  | setfacl: /etc/resolv.conf: Operation not supported
postgresql_1  | Creating database user: gitlab
postgresql_1  | Creating database: gitlabhq_production...
postgresql_1  | ‣ Loading pg_trgm extension...
postgresql_1  | ‣ Loading btree_gist extension...
postgresql_1  | ‣ Granting access to gitlab user...
postgresql_1  | Starting PostgreSQL 12...
postgresql_1  | 2021-03-20 20:00:08.727 UTC [1] LOG:  starting PostgreSQL 12.3 (Ubuntu 12.3-1.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
redis_1       | 1:C 20 Mar 2021 20:00:02.648 # Redis version=5.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1       | 1:C 20 Mar 2021 20:00:02.648 # Configuration loaded
redis_1       | 1:M 20 Mar 2021 20:00:02.652 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1       | 1:M 20 Mar 2021 20:00:02.652 # Server initialized
redis_1       | 1:M 20 Mar 2021 20:00:02.652 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
postgresql_1  | 2021-03-20 20:00:08.727 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgresql_1  | 2021-03-20 20:00:08.727 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgresql_1  | 2021-03-20 20:00:08.922 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgresql_1  | 2021-03-20 20:00:09.650 UTC [124] LOG:  database system was shut down at 2021-03-20 20:00:08 UTC
postgresql_1  | 2021-03-20 20:00:10.060 UTC [125] FATAL:  the database system is starting up
postgresql_1  | 2021-03-20 20:00:10.164 UTC [1] LOG:  database system is ready to accept connections
gitlab_1      | Configuring gitlab::oauth...
gitlab_1      | Configuring gitlab::ldap...
gitlab_1      | Configuring gitlab::cron_jobs...
gitlab_1      | Configuring gitlab::backups...
gitlab_1      | Configuring gitlab::registry...
gitlab_1      | Configuring gitlab::pages...
gitlab_1      | Configuring gitlab::sentry...
gitlab_1      | Configuring gitlab-shell...
gitlab_1      | Configuring nginx...
gitlab_1      | Configuring nginx::gitlab...
gitlab_1      | Migrating database...
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | 2021-03-21 01:30:16,209 CRIT Supervisor running as root (no user in config file)
gitlab_1      | 2021-03-21 01:30:16,210 INFO Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,210 INFO Included extra file "/etc/supervisor/conf.d/gitaly.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,210 INFO Included extra file "/etc/supervisor/conf.d/gitlab-workhorse.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,210 INFO Included extra file "/etc/supervisor/conf.d/groups.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,210 INFO Included extra file "/etc/supervisor/conf.d/mail_room.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,210 INFO Included extra file "/etc/supervisor/conf.d/nginx.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,210 INFO Included extra file "/etc/supervisor/conf.d/puma.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,211 INFO Included extra file "/etc/supervisor/conf.d/sidekiq.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,211 INFO Included extra file "/etc/supervisor/conf.d/sshd.conf" during parsing
gitlab_1      | 2021-03-21 01:30:16,236 INFO RPC interface 'supervisor' initialized
gitlab_1      | 2021-03-21 01:30:16,236 CRIT Server 'unix_http_server' running without any HTTP authentication checking
gitlab_1      | 2021-03-21 01:30:16,236 INFO supervisord started with pid 608
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | 2021-03-21 01:30:17,239 INFO spawned: 'gitaly' with pid 629
gitlab_1      | 2021-03-21 01:30:17,243 INFO spawned: 'puma' with pid 630
gitlab_1      | 2021-03-21 01:30:17,248 INFO spawned: 'gitlab-workhorse' with pid 631
gitlab_1      | 2021-03-21 01:30:17,252 INFO spawned: 'sidekiq' with pid 632
gitlab_1      | 2021-03-21 01:30:17,256 INFO spawned: 'nginx' with pid 633
gitlab_1      | 2021-03-21 01:30:17,261 INFO spawned: 'sshd' with pid 634
gitlab_1      | 2021-03-21 01:30:17,264 INFO spawned: 'cron' with pid 635
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | 2021-03-21 01:30:18,244 INFO success: gitaly entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab_1      | 2021-03-21 01:30:18,244 INFO success: puma entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab_1      | 2021-03-21 01:30:18,282 INFO success: gitlab-workhorse entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab_1      | 2021-03-21 01:30:18,283 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab_1      | 2021-03-21 01:30:18,283 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab_1      | 2021-03-21 01:30:18,283 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab_1      | 2021-03-21 01:30:18,283 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/acts-as-taggable-on-6.5.0/lib/acts_as_taggable_on/tagging.rb:9: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/associations.rb:1657: warning: The called method `belongs_to' is defined here
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/marginalia-1.9.0/lib/marginalia.rb:94: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/postgresql_adapter.rb:648: warning: The called method `execute_and_clear_without_marginalia' is defined here
postgresql_1  | 2021-03-20 20:01:17.386 UTC [140] ERROR:  relation "postgres_partitions" does not exist at character 454
postgresql_1  | 2021-03-20 20:01:17.386 UTC [140] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
postgresql_1  |                pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
postgresql_1  |                c.collname, col_description(a.attrelid, a.attnum) AS comment
postgresql_1  |           FROM pg_attribute a
postgresql_1  |           LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
postgresql_1  |           LEFT JOIN pg_type t ON a.atttypid = t.oid
postgresql_1  |           LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
postgresql_1  |          WHERE a.attrelid = '"postgres_partitions"'::regclass
postgresql_1  |            AND a.attnum > 0 AND NOT a.attisdropped
postgresql_1  |          ORDER BY a.attnum
postgresql_1  |
postgresql_1  | 2021-03-20 20:01:17.652 UTC [141] ERROR:  relation "postgres_partitions" does not exist at character 454
postgresql_1  | 2021-03-20 20:01:17.652 UTC [141] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
postgresql_1  |                pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
postgresql_1  |                c.collname, col_description(a.attrelid, a.attnum) AS comment
postgresql_1  |           FROM pg_attribute a
postgresql_1  |           LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
postgresql_1  |           LEFT JOIN pg_type t ON a.atttypid = t.oid
postgresql_1  |           LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
postgresql_1  |          WHERE a.attrelid = '"postgres_partitions"'::regclass
postgresql_1  |            AND a.attnum > 0 AND NOT a.attisdropped
postgresql_1  |          ORDER BY a.attnum
postgresql_1  |
postgresql_1  | 2021-03-20 20:01:18.500 UTC [142] ERROR:  relation "postgres_partitions" does not exist at character 454
postgresql_1  | 2021-03-20 20:01:18.500 UTC [142] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
postgresql_1  |                pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
postgresql_1  |                c.collname, col_description(a.attrelid, a.attnum) AS comment
postgresql_1  |           FROM pg_attribute a
postgresql_1  |           LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
postgresql_1  |           LEFT JOIN pg_type t ON a.atttypid = t.oid
postgresql_1  |           LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
postgresql_1  |          WHERE a.attrelid = '"postgres_partitions"'::regclass
postgresql_1  |            AND a.attnum > 0 AND NOT a.attisdropped
postgresql_1  |          ORDER BY a.attnum
postgresql_1  |
gitlab_1      | rake aborted!
gitlab_1      | StandardError: An error has occurred, this and all later migrations canceled:
gitlab_1      |
gitlab_1      | key must be 32 bytes or longer
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/encryptor-3.0.0/lib/encryptor.rb:60:in `crypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/encryptor-3.0.0/lib/encryptor.rb:36:in `encrypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted.rb:266:in `encrypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted.rb:350:in `encrypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted.rb:165:in `block (2 levels) in attr_encrypted'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:77:in `block in attr_encrypted'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:50:in `public_send'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:50:in `_assign_attribute'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:43:in `block in _assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:42:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:42:in `_assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/attribute_assignment.rb:21:in `_assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:35:in `assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:29:in `perform_attribute_assignment'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:36:in `assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/persistence.rb:620:in `block in update'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:278:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:212:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/persistence.rb:619:in `update'
gitlab_1      | /home/git/gitlab/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb:21:in `block in up'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `block (2 levels) in find_each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `block in find_each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:238:in `block in in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:222:in `loop'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:222:in `in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:135:in `find_in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:69:in `find_each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/querying.rb:21:in `find_each'
gitlab_1      | /home/git/gitlab/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb:20:in `up'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:831:in `exec_migration'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:811:in `block in migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:810:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1002:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:212:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1361:in `ddl_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1280:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1280:in `migrate_without_lock'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1229:in `block in migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1382:in `with_advisory_lock'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1229:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1061:in `up'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1036:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/railties/databases.rake:84:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
gitlab_1      |
gitlab_1      | Caused by:
gitlab_1      | ArgumentError: key must be 32 bytes or longer
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/encryptor-3.0.0/lib/encryptor.rb:60:in `crypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/encryptor-3.0.0/lib/encryptor.rb:36:in `encrypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted.rb:266:in `encrypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted.rb:350:in `encrypt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted.rb:165:in `block (2 levels) in attr_encrypted'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:77:in `block in attr_encrypted'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:50:in `public_send'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:50:in `_assign_attribute'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:43:in `block in _assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:42:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:42:in `_assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/attribute_assignment.rb:21:in `_assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activemodel-6.0.3.3/lib/active_model/attribute_assignment.rb:35:in `assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:29:in `perform_attribute_assignment'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/attr_encrypted-3.1.0/lib/attr_encrypted/adapters/active_record.rb:36:in `assign_attributes'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/persistence.rb:620:in `block in update'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:278:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:212:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/persistence.rb:619:in `update'
gitlab_1      | /home/git/gitlab/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb:21:in `block in up'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `block (2 levels) in find_each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `block in find_each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:238:in `block in in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:222:in `loop'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:222:in `in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:135:in `find_in_batches'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/relation/batches.rb:69:in `find_each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/querying.rb:21:in `find_each'
gitlab_1      | /home/git/gitlab/db/migrate/20201008013434_generate_ci_jwt_signing_key.rb:20:in `up'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:831:in `exec_migration'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:811:in `block in migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:810:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1002:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/transactions.rb:212:in `transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1361:in `ddl_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1280:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1280:in `migrate_without_lock'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1229:in `block in migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1382:in `with_advisory_lock'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1229:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1061:in `up'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/migration.rb:1036:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/railties/databases.rake:84:in `each'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.3/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
gitlab_1      | /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
gitlab_1      | Tasks: TOP => db:migrate
gitlab_1      | (See full trace by running task with --trace)
gitlab_1      | Installing configuration templates...

@turbra
Copy link

turbra commented Apr 4, 2021

Switching to the nightly release resolved the error for me. It proceeded to perform the migration and upgrade. Not ideal to be on a nightly for some people, but it works.

@sattellite
Copy link

@turbra what do mean by nightly releases?

@turbra
Copy link

turbra commented Apr 5, 2021

@turbra what do mean by nightly releases?

Change your image tag from latest to nightly

@Lennix
Copy link

Lennix commented Apr 6, 2021

@turbra There is no nightly tag for sameersbn docker. What do you mean exactly?

@Lennix
Copy link

Lennix commented Apr 11, 2021

Does anyone have a solution? I've been running 13.5.4 for several months now, because I'm unable to upgrade.

@turbra
Copy link

turbra commented Apr 11, 2021

Sorry for the delay….by nightly I meant from the gitlab repo directly

@Lennix
Copy link

Lennix commented Apr 11, 2021

Thank you for your answer. I assume you mean gitlab/gitlab-ce:nightly/latest? Is it a drop-in replacement or did you have to change your volumes/env variables?

@turbra
Copy link

turbra commented Apr 11, 2021

The issue is/was a bug in gitlabs update and switching my compose to use gitlab/gitlab-ce:nightly resolved it.

@Lennix
Copy link

Lennix commented Apr 11, 2021

Just for others reading this:
You can't just replace sameersbn/gitlab with gitlab/gitlab-ce

Please ignore turbras comments.

Continuing with this: Does anyone know how to solve this?

@tharbakim
Copy link

@Lennix Not sure how much effort you're wanting to put into it, but I went through a migration from this image to the official image recently for a different issue.
The comments in #2104 were enough of a start to get going, but it is a bit of a process.

@mastermind3043
Copy link

Anyone referring to this issue for non-docker vanilla installation of gitlab CE. One potential root cause is if the underlying OS doesnt support locale en_US.UTF-8, then you will see this error

The database was initialized with LC_COLLATE "en_US.UTF-8", which is not recognized by setlocale()

Add the locale to your system using localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 or locale-gen en_US.UTF-8. Otherwise change the locale in your recipe to one of the supported locales. Then run gitlab-ctl reconfigure

@benjulios
Copy link

I'm also stuck in version 13.5.4 with the exact same issue. Any update soon ?

@umputun
Copy link
Contributor

umputun commented Jun 24, 2021

I just run into the same issue with relation "postgres_partitions" does not exist at character 454 error. This seems to be caused but psql migration confused by multiple version of db data sets. I had 9.4, 9.5, 9.6, and 11. Removing everything except 11 resolved the issue

@tobiaskraft
Copy link

I just run into the same issue with relation "postgres_partitions" does not exist at character 454 error. This seems to be caused but psql migration confused by multiple version of db data sets. I had 9.4, 9.5, 9.6, and 11. Removing everything except 11 resolved the issue

Thanks for the hint, but in my case this doesn't help. I deleted the old stuff with the script ./delete_old_cluster.sh.

@snadal
Copy link

snadal commented Jul 13, 2021

In my case, upgrading from 13.5.4 to 13.6.0 showed the same error message "ERROR: relation "postgres_partitions" does not exist at character 454" the FIRST time I launched 13.6.0, but after that I have been able to launch correctly and following recommended upgrade path (https://docs.gitlab.com/ee/update/#upgrade-paths) I finally upgraded to 14.0.5 without further issues.

@BruceLEO1969
Copy link

Any solution? Also stuck in version 13.5.4 with the exact same issue.

@vstiebe
Copy link

vstiebe commented Mar 1, 2022

@BruceLEO1969 in my case I had to upgrade to every single version of sameersbn tag by tag. It was the only way for us because of the upgrade path https://docs.gitlab.com/ee/update/#upgrade-paths.

In some versions there was background migrations which we had to wait before applying the next update.

But it was easy because is basically adjusting the docker-compose file, restart the containers and watch what was happening with docker logs.

We started with a fresh backup from the original version and had to ignore some warning messages. If gitlab started and there was no background migrations, so we applied the next sameersbn tag on docker hub.

We are now in 14.4.3.

Hope it helps.

@Giveback-ru
Copy link

CREATE OR REPLACE VIEW postgres_partitions AS SELECT pg_namespace.nspname::text || '.'::text || pg_class.relname::text AS identifier,  pg_class.oid AS oid,  pg_namespace.nspname AS schema,  pg_class.relname AS name,  parent_namespace.nspname::text || '.'::text || parent_class.relname::text AS parent_identifier,  pg_get_expr(pg_class.relpartbound, pg_inherits.inhrelid) AS condition FROM pg_class INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace INNER JOIN pg_inherits ON pg_class.oid = pg_inherits.inhrelid INNER JOIN pg_class parent_class ON pg_inherits.inhparent = parent_class.oid INNER JOIN pg_namespace parent_namespace ON parent_class.relnamespace = parent_namespace.oid WHERE pg_class.relispartition AND pg_namespace.nspname IN (current_schema(), 'gitlab_partitions_dynamic', 'gitlab_partitions_static');
grant select,insert,update,delete,truncate,references,trigger on postgres_partitions to gitlab;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests