[
https://issues.apache.org/jira/browse/SPARK-61982?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SPARK-61982:
-----------------------------------
Labels: pull-request-available (was: )
> Classify PostgreSQL permission-denied errors during JDBC schema resolution
> --------------------------------------------------------------------------
>
> Key: SPARK-61982
> URL: https://issues.apache.org/jira/browse/SPARK-61982
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 4.4.0
> Reporter: Aleksandar Trajković
> Priority: Major
> Labels: pull-request-available
>
> When a JDBC read resolves a table's schema (JDBCRDD.resolveTable), Spark
> classifies the remote engine's error through dialect hooks: object not found,
> object not selectable, and syntax error (JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR).
> A PostgreSQL permission-denied error (SQLSTATE 42501, insufficient_privilege)
> matches none of them. SPARK-59336 made sure it is not reported as a syntax
> error, but it still reaches the user unclassified:
> * spark.read.format("jdbc") throws the raw PSQLException.
> * A JDBC catalog read reports the generic FAILED_JDBC.LOAD_TABLE.
> Steps to reproduce:
> {code:sql}
> -- PostgreSQL, as a superuser
> CREATE TABLE bar (c INT);
> CREATE USER restricted_user PASSWORD 'restricted_password';
> {code}
> {code:scala}
> spark.read.format("jdbc")
> .option("url", "jdbc:postgresql://<host>:<port>/postgres")
> .option("dbtable", "bar")
> .option("user", "restricted_user")
> .option("password", "restricted_password")
> .load()
> // throws org.postgresql.util.PSQLException (SQLSTATE 42501): ERROR:
> permission denied ...
> {code}
> Proposal: add a dialect hook JdbcDialect.isPermissionDeniedException (default
> false; PostgreSQL returns true for SQLSTATE 42501) and a new error condition
> 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. Other dialects can override the hook later.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]