Repository navigation
fix(transfer): coerce values across engines in Table Transfer, Data Sync and SQL export - #4381
Merged
Merged
Conversation
…ync and SQL export
Table Transfer and Data Sync coerced only bit strings across engines, so
booleans, MySQL zero-dates, zoned timestamps and PostgreSQL arrays were written
raw. Both now run the full CrossEngineValueCoercer Object Copy uses, through one
shared per-value helper. SQLite targets keep temporal text verbatim.
SQL export wrote decode('<hex>','hex') for every Postgres-family engine;
KingbaseES and Redshift restored it as the wrong bytes.
Refs #4269
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
Three cross-engine value-correctness fixes from the #4269 audit (IE-04 plus two the audit review surfaced):
CrossEngineValueCoercerObject Copy uses, for every mapped column, whenever the source and target type families differ.decode('<hex>','hex')for every PostgreSQL-family engine; KingbaseES readsdecodeas Oracle's DECODE and Redshift has no bytea, so both restored wrong bytes. They now get'\x..'::byteaandfrom_hex(..), matching the app's measuredCompareSQLLiteral.SQ-7's SQLite premise does not hold: SQLite already streams the source in bounded batches across Object Copy, Table Transfer and export, so none of them buffers the whole table.
Not in this PR (need a live server)
executeBoundedQuery, so the fix is per-driver streaming overrides that only a live server can verify.Test plan
TableTransferServiceTests: PG boolean to MySQL TINYINT, MySQL zero-date to PostgreSQL NULL, PG timestamptz to MySQL DATETIME, PG array to MySQL JSON. Fail on main (written raw), pass here.DataSyncScriptBuilderTests(DataSyncCrossEngineCoercionTests): the same four, plus a same-engine guard that a MySQL zero-date stays as it came rather than turning into NULL.CrossEngineValueCoercerTests: the shared static matches the row coercer.SQLExportBinaryLiteralTests: KingbaseES'\x..'::bytea, Redshiftfrom_hex(..).postgresUsesDecodeupdated, since it pinned the buggy Redshiftdecode, to cover only the engines that take it.Refs #4269