user_update_9301 fails again Postgres14 durin upgrade

Created on 19 April 2022, over 2 years ago
Updated 19 January 2023, almost 2 years ago

Problem/Motivation

When upgrading to Drupal 9.3.11 the upgrade fails with the error message:

>  [notice] Update started: user_update_9301
>  [error]  SQLSTATE[42P07]: Duplicate table: 7 ERROR:  relation "users_uid_seq" already exists: CREATE SEQUENCE users_uid_seq; Array

Tracking down the code i could understand that the statement causing that is

$connection->schema()->changeField('users', 'uid', 'uid', ['type' => 'serial', 'not null' => TRUE], $new_keys);

Causes the issue. A statement that is run on every database type. I have seen that https://www.drupal.org/project/drupal/issues/3255419 🐛 Updating to Drupal 9.3 fails when sql_require_primary_key MySQL system variable is ON. Fixed was an attempt to fix the upgrade for PG and Mysql, but at least for me it has not been solved.

Steps to reproduce

- Run Drupal 8 (8.9.20) on PG14
- Upgrade to Drupal 9.3.11
- Run update-db

Proposed resolution

Workaround, from #11

  1. drush sql:query "ALTER SEQUENCE users_uid_seq RENAME TO users_uid_seq2"
  2. doing drush updb.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

9.3

Component
Database update 

Last updated 8 days ago

No maintainer
Created by

🇩🇪Germany EugenMayer

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024