Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
postgresql db driver
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Jan 2021 at 10:28 UTC
Updated:
25 Apr 2023 at 09:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
daffie commentedI have set the priority to critical, because it is blocking #3081144: Database primary keys can exceed maximum integer storeable (has actually occurred, in watchdog) and that issue is critical.
Comment #3
daffie commentedComment #6
stephencamilo commentedComment #7
hestenetReset issue status.
Comment #8
quietone commentedAdding tag.
Comment #10
xjmTagging since #3081144: Database primary keys can exceed maximum integer storeable (has actually occurred, in watchdog) is postponed on this.
Comment #11
xjmThe IS says there's a bug, but not what the bug is.
Comment #13
larowlanComment #14
larowlanWe discussed this in the bug smash meeting today - here's an untested stab at a test and some code
Comment #15
larowlanProbably need some asserts in that test 🤦♂️ serves me right for trying to write a patch and run a meeting.
Comment #16
_utsavsharma commentedFIxed CCF for 10.1.x of #14.
Please review.
Comment #17
larowlanAttempt to fix the test
Comment #18
andypostCame from #3327520: Postgres error 500 on paths when supplied entity ID gte 2147483647 and lte 9223372036854776832 where I see that when serial column value passed as string a query will fail
Comment #19
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #20
daffie commentedI think that we for PostgreSQL first need to remove the sequence, than change the field from an integer to a big integer field. After that is done can a new sequence be created. This can be done in the method changeField(). In that method we are already doing the same with constraints on the field. Just before removing the contraints on the field remove the sequence.
Comment #21
arantxioI've been working on this, and created a patch that seems to the pass all tests.
Comment #22
daffie commentedAdd a space between 'serial' and =>.
This method does not have to be public. Just make it a protected method.
We need to check that after we change the field to be a big serial field, that can store a big integer value. After we have tested that we should insert another row in the table and the value of the big serial should be the old big integer value +1.
Comment #23
arantxioAdded the requested changes from @daffie in #22.
Comment #24
arantxioMy bad, didn't check the styling.
Comment #26
daffie commentedThe testbot for MySQL returns an syntax error:
Comment #27
arantxioI've changed the varchar_acsii type to text, which seems to be working on my end.
Comment #28
arantxioChanged the test with some help from @daffie, this should be a bit better to understand.
Comment #29
daffie commentedAll code changes look good to me.
All my remarks have been addressed.
I have updated the IS.
For me it is RTBC.
Comment #30
larowlanJust for my understanding (I've not used postgres for about 15 years) can you elaborate on the type of objects that this will remove in Drupal?
Does the table gets removed? We don't do foreign keys so I assume it doesn't spider out to other tables.
Comment #31
daffie commented@larowlan: The cascade option is necessary, because a sequence in PostgreSQL can have dependencies behind it like a constraint that the value cannot be lower then zero. When you delete the sequence, the constraint also needs to be deleted. The alternative is to delete the constraint first and then delete the sequence. The last option is more work and more that can go wrong.
The text in the comment is about the sequence is preventing the altering of the table. We should change the word "drop" to "alter" in the comment. Hopefully this can be done on commit.
Comment #32
larowlanThanks daffie that makes sense and resolves my concern, I'll look at this tomorrow morning
Comment #33
larowlanWe're in commit freeze so I will wait for that to finish before committing, but this is top of my list
Comment #36
larowlanCommitted to 10.1.x and 10.0.x.
Needs reroll for backport to 9.5.x, the test changes don't apply.
Comment #37
dagmarRerolled for Drupal 9.5.x.
core/tests/Drupal/KernelTests/Core/Database/DriverSpecificSchemaTestBase.phphas a lot of new lines in D10 than D9.5. I hope this doesn't break anything...Comment #38
daffie commentedThe testbot is failing for PostgreSQL.
Comment #39
arantxioThanks @dagmar for the reroll. The function getPrefix, does not exist in D9.5, because this function replaces tablePrefix(). So in this case for Drupal 9.5 we need to revert back to using tablePrefix().
I could not create a interdiff unfortunately, but I only changed the function getPrefix to tablePrefix($table) in pgsql/Schema / getSequenceName()
Comment #40
alexpottThis issue relies on code from #3257201: Create the new method Drupal\Core\Database\Connection::getPrefix() and deprecate Drupal\Core\Database\Connection::prefixTable($table) so we have to revert it from 10.0.x as that issue is only in 10.1.x.
Comment #42
daffie commentedNo backport needed any more
Comment #43
alexpottOn 10.0.x prior to the revert if you run
core/tests/Drupal/KernelTests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.phpyou will get an error like:Comment #44
alexpott