aleksandar-trajkovic-db opened a new pull request, #60673:
URL: https://github.com/apache/spark/pull/60673
### What changes were proposed in this pull request?
Add the dialect hook `JdbcDialect.isPermissionDeniedException` (PostgreSQL:
SQLSTATE 42501). When it matches during JDBC schema resolution, raise the new
`JDBC_EXTERNAL_ENGINE_PERMISSION_ERROR.DURING_OUTPUT_SCHEMA_RESOLUTION`
(SQLSTATE 42501). It has the same parameters as
`JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR`, and the driver exception is kept as the
cause.
### Why are the changes needed?
A PostgreSQL permission-denied error during schema resolution should be
reported as a permission error. Today it is unclassified (SPARK-59336 stopped
it from being reported as a syntax error): `spark.read.format("jdbc")` as a
user without `SELECT` throws the raw `PSQLException: ERROR: permission denied
...`, and a JDBC catalog read reports `FAILED_JDBC.LOAD_TABLE`.
### Does this PR introduce _any_ user-facing change?
Yes. For PostgreSQL, a permission-denied error during schema resolution now
raises `JDBC_EXTERNAL_ENGINE_PERMISSION_ERROR` instead of the raw
`SQLException` (V1) or `FAILED_JDBC.LOAD_TABLE` (catalog). The hook is
`@Since("4.4.0")`, so this should also be merged to `branch-4.4`.
### How was this patch tested?
New tests in `JDBCSuite` and `PostgresIntegrationSuite`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
This pull request and its description were written by Isaac.
--
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]