hutiefang76 opened a new pull request, #12877:
URL: https://github.com/apache/seatunnel/pull/12877
### Purpose of this pull request
A catalog connected to database A truncates A's table when the full table
path names database B. With one row in each same-named PostgreSQL table,
`truncateTable(B.public.t, false)` currently produces **A=0, B=1**, instead of
**A=1, B=0**.
Select the connection URL from the explicit table database in
`truncateTableInternal`, like sibling DDL paths. Preserve the default URL for
an internal path without a database. Add a two-database regression to the
existing PostgreSQL IT, keep the routing unit controls, and clarify the
full-path target in English/Chinese docs.
Fixes #12873. Yes, I am contributing this fix to Apache SeaTunnel.
### Does this PR introduce _any_ user-facing change?
Yes. Truncate runs against the explicitly named database and preserves the
same-named table in the catalog's default database. APIs, options and SQL
quoting are unchanged. The docs only describe the verified explicit-database
path.
### How was this patch tested?
- Baseline: four catalog unit tests, one routing failure; actual public
PostgreSQL 17 catalog call produces A=0, B=1.
- Fixed `AbstractJdbcCatalogTest`: **4/4 pass**, no skips.
- Existing `JdbcPostgresIT#testTruncateTableUsesTablePathDatabase`: **one
passes**, no failures/errors/skips, with actual PostgreSQL 18 in the project's
PostGIS image. It asserts both row counts and cleans up the dedicated
tables/database.
- Supplementary composed-class validation with #12872 passes on PostgreSQL
13 and 17, including A=1, B=0.
- Spotless, default root `./mvnw -q -DskipTests verify` and independent
full-diff review pass. Root verify skips tests. Final docs wording/line-break
cleanup changes no executable code. JDK 17.0.18.
- Full JDBC package: **1,156 tests, one failure, zero errors, six
conditional skips**. The failure is the unchanged source-only-option
completeness test, reproduced on clean dev and fixed separately in #12875. No
routing regression fails; that correction is not included here.
```sh
./mvnw -pl seatunnel-connectors-v2/connector-jdbc -am package
./mvnw -pl
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-jdbc-e2e/connector-jdbc-e2e-part-3
-am \
-DskipUT=true -DskipIT=false \
'-Dit.test=JdbcPostgresIT#testTruncateTableUsesTablePathDatabase' \
-Dfailsafe.failIfNoSpecifiedTests=false -DfailIfNoTests=false verify
./mvnw -q -DskipTests verify
```
### Check list
* [ ] New JAR license notice: not applicable; no new dependency.
* [x] English/Chinese JDBC sink documentation updated.
* [ ] Incompatible changes: no option/API change; this corrects the database
targeted by the existing operation.
* [x] Existing PostgreSQL IT updated. No new connector registration/plugin
config needed.
<sub>Implemented, tested, independently reviewed and posted with AI
assistance for @hutiefang76.</sub>
--
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]