Repository navigation
Merged
Conversation
…un Read-Only in the read-only transaction
…nd keep one changelog entry
datlechin
enabled auto-merge (squash)
November 13, 2026 01:13
# Conflicts: # apple/TableProMobile/TableProMobile/Localizable.xcstrings
# Conflicts: # apple/TableProMobile/TableProMobile/Helpers/ReadOnlyFunctionGuard.swift # apple/TableProMobile/TableProMobileTests/Drivers/FakeMySQLServer.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[db].[schema].[table]: browse, count, search, row lookup, save, insert, delete, truncate and drop. Column, index and foreign key reads run asEXEC [db].sys.sp_executesql, so they read that database's catalog and leave the session where it is. The table and schema lists read the database the app last switched to, so a typedUSEmoves them only once the menu follows it.USErun was in flight, or while the session sat in another database). Run still waits in every window until the menu follows aUSE.START TRANSACTION READ ONLYand thenROLLBACK, as the Mac plugins do. PostgreSQL addsSELECT 1, so noSET TRANSACTION READ WRITEcan follow, and sends the statement through the extended protocol, which takes one command. A server refusal (25006, 25001, 1792) reads as Read-Only refusing it.LOCK TABLES. A MySQL session with autocommit off holds a transaction after every statement (measured on 8.4.13), so it keeps the refusal and runs reads as before.LibPQReadOnlyTransaction.swiftandMySQLReadOnlyTransaction.swiftkeep the shared part; the new+Statement.swiftfiles keep the plugin part. Mac behavior is unchanged.pg_terminate_backend,GET_LOCK), as on the Mac.Tests changed on purpose:
ConnectionCoordinatorCatalogTests:useRunRefusesSQLServerWritesanduseRunLeavesMySQLWritesAlonebecameuseRunHoldsOnlyRun(type:);sqlServerSessionElsewhereRefusesWritesbecamesqlServerWindowNamesTheDatabaseItShows.ReadOnlyFunctionGuardTests:refusesAnUnlistedCallbecamerefusesAnUnlistedCallWithoutReadOnlyMode;runsBuiltinsandrefusesOnlyAtReadOnlyWhereFunctionsWritepass the driver's mode.Docs: TableProApp/docs#231
Needs the maintainer
START TRANSACTION READ ONLYto MySQL before 5.6.5 and MariaDB before 10.0, which do not have it (vendor release notes), so Read-Only there likely fails every read with a syntax error (not measured). iOS keeps the function check on those servers instead.MySQLServerVersion.hasReadOnlyTransactionsis ready if the Mac should gate on it.Test plan
SQLBuilderSchemaQualificationTests(three-part names),MSSQLCatalogDatabaseTests, SQL Server cases inDataBrowserViewModelTests,RowWriteRoutingTests,RowInsertPlannerTests,ForeignKeyReferenceTests,ForeignKeyPreviewModelTests,ConnectionCoordinatorCatalogTests;PostgreSQLReadOnlyRunTestsandMySQLReadOnlyRunTestsdrive the real iOS drivers against the fake servers (begin, statement and ROLLBACK on success, a failed statement, a refusal before or after rows, the row cap and a following query; an open transaction or a heldLOCK TABLESrefused before the read-only transaction goes out);ReadOnlyFunctionGuardTests,MySQLSessionTransactionTests,PostgreSQLStreamTests,QueryEditorViewModelTests; MacMySQLServerVersionTests.readOnlyTransactionFloor.MySQLReadOnlyTransactionTests,MySQLServerVersionTests,LibPQBoundedReadOnlyTests,LibPQReadOnlyTransactionTestspass (41);AllPluginsbuilds;TableProDatabaseTestsandTableProModelsTestspass (199).TableProMobileandTableProMobileTestsbuild for testing here, and the tests run on CI (ios-tests.yml).SET TRANSACTION READ WRITEinside is refused (25001, 1568); a two-command statement through the extended protocol is refused (42601).