xiaobaicai66695 opened a new pull request, #1146: URL: https://github.com/apache/incubator-seata-go/pull/1146
### What this PR does This PR fixes PostgreSQL AT before-image SQL generation when string literals contain PostgreSQL-style placeholder text such as `'$2'`. The previous flow could restore a string literal as `_UTF8MB4$2`, then `CompactPostgreSQLPlaceholders` scanned the restored SQL text and treated `$2` as a bind placeholder. This could either return `postgres placeholder index 2 out of range` or compact the wrong argument when enough arguments exist. ### Changes - Preserve single-quoted string literals when restoring PostgreSQL before-image SQL for `UPDATE` and `DELETE`. - Normalize parser-emitted MySQL charset introducers for PostgreSQL string literals, e.g. `_UTF8MB4'...'` to `'...'`. - Make PostgreSQL placeholder rewriting/compaction skip quoted strings, quoted identifiers, comments, and dollar-quoted strings. - Add regression coverage for PostgreSQL `UPDATE` and `DELETE` before-image SQL with `$n` text inside string literals. ### Tests - `go test ./pkg/datasource/sql/util` - `go test ./pkg/datasource/sql/exec/at -run "PostgreSQLPlaceholderInLiteral|PostgreSQL$" -count=1` - `go test ./pkg/datasource/sql/...` - `go vet ./pkg/datasource/sql/...` - `git diff --check` Fixes #1145 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
