hutiefang76 opened a new issue, #12873:
URL: https://github.com/apache/seatunnel/issues/12873
### Search before asking
- [x] Searched open/closed issues and PRs and inspected adjacent fixes; no
same-purpose fix found.
### What happened
A PostgreSQL catalog connected to database `db_a` executes
`truncateTable(TablePath.of("db_b", "public", "t"), false)` against `db_a`,
even though the table path explicitly names `db_b`.
Reproduced with the current public `PostgresCatalog.truncateTable()` against
two fresh PostgreSQL 17 databases. Both have `public.oss_truncate_probe` with
one row. After truncating the path in database B, actual row counts are **A=0,
B=1**; expected **A=1, B=0**. No exception is thrown. The isolated test uses
only disposable tables and databases. An existing catalog unit suite also
reports four tests with one routing failure and no errors/skips.
`truncateTable()` checks existence in the table database, but
`AbstractJdbcCatalog.truncateTableInternal()` then calls
`executeInternal(defaultUrl, ...)`. PostgreSQL's truncate SQL contains
schema/table only, so it operates in the catalog's default database. Sibling
DDL paths choose the URL from the table path.
I will select the table database URL for an explicit database and preserve
the existing default URL when the internal path has none. I will extend the
existing `AbstractJdbcCatalogTest` and `JdbcPostgresIT` to assert both
databases' row counts, validate against real PostgreSQL, and add
English/Chinese documentation. This does not change APIs, options, SQL quoting,
DuckDB overrides (#12673), or the existence-check fix in #7654.
### SeaTunnel Version
Dev at `e2957d27afa29d4de4324cf642450757d865b902`.
### SeaTunnel Config
Direct public JDBC converter/catalog API reproduction, no engine job.
PostgreSQL 17 in an isolated local test container; numeric-literal
compatibility also checked with PostgreSQL 13.
### Running Command
```sh
./mvnw -pl seatunnel-connectors-v2/connector-jdbc -am \
-Dtest=AbstractJdbcCatalogTest -Dsurefire.failIfNoSpecifiedTests=false \
-DfailIfNoTests=false package
```
Actual database validation uses the compiled current production classes and
the public APIs described above.
### Error Exception
```text
4 tests, 1 failure, 0 errors/skips
```
### Java or Scala Version
JDK 17.0.18, macOS ARM64.
### Are you willing to submit PR?
- [x] Yes, I am contributing this fix to Apache SeaTunnel.
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
<sub>Reproduction and report prepared and posted by an AI assistant 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]