Repository navigation
fix(import): import preview rows use source_row, row_number is reserved on MariaDB (beta) - #5957
Conversation
…riaDB `row_number` is a reserved word on MariaDB, and Doctrine does not quote it there because its MariaDB keyword list lacks the word. The CREATE TABLE in Version1Date20260915050000 therefore failed with error 1064 on every MariaDB install, fresh or upgrading. - Version1Date20260915050000 now creates `row_no`. - Version1Date20261106120000 renames an existing `row_number` (PostgreSQL, SQLite, MySQL 8, and MariaDB tables created by hand as a workaround) with one quoted RENAME COLUMN, so the rows and the unique index stay. - ImportPreviewRow, its mapper and ImportPreviewService use `rowNo`; the JSON key `row` is unchanged. - ReservedColumnNamesTest checks every migrated column against the reserved words measured on MariaDB 11.3 and MySQL 8.0. - The app version moves so existing installs run the new migration. Closes #4909 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…5879) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed on MariaDB Enabling the app on MariaDB 11.4 failed with error 1064: Doctrine leaves row_number unquoted there. Version1Date20260915050000 now creates source_row. Version1Date20261106080000 renames the column on installs that already hold it, with one quoted RENAME COLUMN, so their rows and the unique index stay. The version moves with it, or occ upgrade would not read the new step. The API is unchanged: rows are still answered under the key row. Assisted-by: ClaudeCode:claude-opus-5-5 (cherry picked from commit 8f5838c)
Assisted-by: ClaudeCode:claude-opus-5-5 (cherry picked from commit cbc50fe)
…words on MariaDB and MySQL Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ine quotes each word Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WilcoLouwerse
left a comment
There was a problem hiding this comment.
Verdict: APPROVE (Thorough · full)
Self-review, so it is posted as a comment (GitHub refuses an approval of your own PR). This is a faithful backport of #5879 to beta, with two tests that would catch the same class of bug next time. There are no blockers. One nit was fixed on the branch before posting, and one is handled in the PR description.
Connected issues
| Issue | Relation | State | Action |
|---|---|---|---|
| #4909 | fixed on beta by this PR (on development by #5879) |
open | beta is not the default branch, so the merge will not close it |
| #4311 | MySQL 8 install fails earlier (JSON default); outside this PR | open | none |
🟢 Nits
- f2: the description said
Closes #4909. That keyword only acts on merges intomain, the default branch; #5879 intodevelopmentleft #4909 open for the same reason. The description now says the issue is closed by hand. - f3, fixed in 1f079e7: the comment above
ReservedColumnNamesTest::ALREADY_IN_USEsaid Doctrine has every listed word in both its MariaDB and MySQL keyword lists.groupsis missing from the MariaDB list andoffsetfrom the MySQL 8 list. Neither is a live bug, becausegroupsis not reserved on MariaDB 11.3 andoffsetis not reserved on MySQL 8.0 (per the fixtures). The comment now says where Doctrine quotes each word.
✅ Verified clean
-
Backport fidelity: these files are byte-identical to
origin/development:Version1Date20260915050000Version1Date20261106120000ImportPreviewRowVersion1Date20261106120000TestImportPreviewServiceTest
The remaining mapper, service and controller-test differences are development-only drift (
QueryPage, the*InterfaceDI types), not part of #5879. Both cherry-picks carry their-xtrailers. The golden fixture does not exist onbeta, so dropping it is correct. -
No leftover of the reverted
row_novariant anywhere in the tree. The remainingrow_number/rowNumberhits belong to the migration packs and the import service, not to this table. The JSON keyrowis unchanged. -
The rename SQL is valid on MariaDB 10.5.2+, MySQL 8, PostgreSQL and SQLite 3.25+.
getTableName()/getColumnName()give backticks and*PREFIX*, andfinishQueryturns those into"on PostgreSQL and SQLite. The unique index follows the rename on every engine. -
Fresh installs take the schema-only path, which skips
preSchemaChange. That is correct, becauseVersion1Date20260915050000now createssource_row. The class has nochangeSchema, soSchemaReuseHygieneTestholds. -
<version>2.1.42-beta.20261106120000is higher than2.1.42-beta.20261102161558, andcheck-migration-version-bumppasses. -
The new tests:
ImportPreviewRowMapperMigratedTestfails on arow_numbercolumn and on an unquoted sort.ReservedColumnNamesTestguards against an empty schema and against a stale allowance.- Both use the existing
MigratedSqliteDatabase.
Gates: quality / Hydra Gates succeeded on 9b782c9, the reviewed head. On 1f079e7 (a comment-only change on top of it) CI was still running at the time of this verdict.
CI: on 9b782c9 everything was green except E2E and the Quality Report, which were still pending. That includes PHPUnit on PHP 8.3 and 8.4 × NC stable32–35 (29151 tests), phpcs, phpmd, psalm and phpstan.
Local: MariaDB 11.3 and PostgreSQL 16 rig scenarios (fresh install, upgrade from the failed state, hand-made tables with rows), as listed in the description.
Not run: no pre-push adversarial agent for 1f079e7: it changes three comment lines and no code.
Analysis: one Thorough agent. Of its three nits, one was refuted on verification: it read the sync as development → beta only, but beta → development sync PRs exist (#5398).
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-specs | ✅ | ||||
| test-l10n | ✅ | ||||
| test-l10n-parity | ✅ | ||||
| format | ✅ | ||||
| check-schema-l10n | ✅ | ||||
| composer | ✅ | ✅ 165/165 | |||
| npm | ✅ | ✅ 640/640 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ✅ | ||||
| lockfile sync | ✅ | ||||
| PHPUnit | ✅ 29134/29134 · 18 skipped (8 legs) | ||||
| Newman | ✅ 714/714 | ||||
| Playwright | ❌ 249/327 · 5 skipped · 161 did not run | ||||
| Hydra gates | ✅ |
Quality workflow — 2026-11-06 17:54 UTC
Download the full PDF report from the workflow artifacts.
Summary
Backport of #5879 (merged into
developmenton 6 November) tobeta, plus two tests. This fixes #4909 onbeta, and the App Store beta is built frombeta.Version1Date20260915050000createdopenregister_import_preview_rowswith a columnrow_number. That word is reserved on MariaDB, and Doctrine DBAL does not quote it there:row_numberis missing from DBAL's MariaDB keyword list, while its MySQL 8 list has it. So every MariaDB install, fresh or upgrading, stopped withSQLSTATE[42000] 1064 … near 'row_number'.8f5838c24bandcbc50fe247from fix(import): import preview rows use source_row, row_number is reserved on MariaDB #5879 are cherry-picked with-x.Version1Date20260915050000now createssource_row. The newVersion1Date20261106120000renames an existingrow_numberwith one quotedRENAME COLUMN, so the rows andidx_or_improw_uniquestay.ImportPreviewRowand its mapper follow the new name, and the JSON keyrowis unchanged.Version1Date20260915050000are byte-identical todevelopment. So the next beta → development sync carries the same class under the same name.tests/Unit/Db/fixtures/mapper-paging-golden.json, which does not exist onbeta. The<version>is set beta-style, to2.1.42-beta.20261106120000.ImportPreviewRowMapperMigratedTestruns the mapper's queries as real SQL against the table the migrations create. It checks that the table hassource_rowand notrow_number, and that rows come back in source order.ReservedColumnNamesTestchecks every migrated column against the words MariaDB 11.3 and MySQL 8.0 refuse unquoted. These lists were measured on those servers (tests/Unit/Migration/fixtures/). The reserved names already in use, which DBAL does quote, are listed as known exceptions:cursor,groups,limit,offset,schema,schemasandtrigger.The first push of this branch had its own fix with
row_no, written before I saw #5879. It is reverted inafe626ea48, sobetaanddevelopmentend up with the same column.MySQL 8 was not affected by
row_number, because DBAL quotes it there. A fresh MySQL 8 install still fails earlier, on #4311 (a JSON column with a default value); that is outside this PR.Checks
Ran, on NC 35.0.2 + MariaDB 11.3 with the 2.1.42-beta tarball plus this branch:
installed_versionlowered);Without the fix, the fresh install and the upgrade reproduce the 1064. OpenCatalogi 2.1.42-beta.20261106064323 was enabled alongside.
Ran, on NC 35.0.2 + PostgreSQL 16: an upgrade from the 2.1.42-beta with rows in
row_number(renamed, rows and index kept).Review fix
1f079e7cca(fix(import): import preview rows use source_row, row_number is reserved on MariaDB (beta) #5957 f3): the reserved-word allowance comment now says where Doctrine quotes each word;ReservedColumnNamesTestgreen after it.Ran: the import-preview tests, the controller test,
Version1Date20261106120000Test,SchemaReuseHygieneTestand the two new tests, 52 tests, all green. With the old column name put back, the mapper test (4 tests) andReservedColumnNamesTestfail. That check ran on the first push's variant of the fix.Ran, on the first push's variant of the fix: the full Unit suite in a NC 35 container, 29151 tests. The only ones that did not pass need what that container lacks:
MigrationVersionBumpCheckTest(7, nogit) andChunkMapperLiveQueryTest(5, nooc_openregister_chunkstable). It was not re-run after the switch to the backport.Ran:
check:migration-version(OK). Ran on the first push:composer phpcs,phpmdandphpstan, all green.Not run:
psalmcrashed locally inside its ownConstantTypeResolver(PHP 8.4), so it gives no verdict; CI runs it.Inherited, not touched: hydra gate 67 (
openregister-contract-parity) is red onlib/Contract/EmailLinkReaderInterface.phponbetaitself.Test plan
developmentthrough the beta → development sync PR, as the same files fix(import): import preview rows use source_row, row_number is reserved on MariaDB #5879 already put thereFixes #4909 on
beta.betais not the default branch, so merging does not close the issue: it is closed by hand once the beta release is verified.🤖 Generated with Claude Code