Problem/Motivation

Follow-up from weirdness pointed out in #3026290: PostgreSQL constraints are still not renamed properly on table renames.

The pgsql driver does not use the sequences table because it has a native way of doing so. The Connection::nextId method is used by batch and users to get and potentially set the next sequence for those respective tables. It does using the serial column's sequence in the sequences table.

The result is that users and batch (or anything in contrib that uses Connection::nextId) will increment the same sequence. This does not cause any data loss, but it looks weird.

Steps to reproduce (without any replication):

  • Install Drupal 8
  • Create an additional user
  • Run a batch operation
  • Create a third user
  • The third user will have uid 4, not 3 as expected.

    Proposed resolution

    Maybe nextId should take a new, optional argument of the table and column so that we use a new sequence. This would also require creating sequences for users or batch table. We don't run into the same issue for users as in other drivers because we can start or change the next value of sequences to not conflict with the anonymous user entry.

    And maybe deprecate the sequences_values_seq sequence (but not the sequences table) in a change record.

    Regardless this will require some database updates to change.

    Remaining tasks

    Figure out if this should be done. It's really odd when looking at how things work.

    We added it in the Drupal 7 cycle when DBTNG was first added.

    API changes

    Maybe.

    Data model changes

    Yes.

    Release notes snippet

Comments

mradcliffe created an issue. See original summary.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

daffie’s picture

Status: Active » Closed (duplicate)