cloud-fan commented on code in PR #58621:
URL: https://github.com/apache/spark/pull/58621#discussion_r3964791615


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala:
##########
@@ -260,7 +260,10 @@ private case class PostgresDialect()
 
   // See https://www.postgresql.org/docs/current/errcodes-appendix.html
   override def isSyntaxErrorBestEffort(exception: SQLException): Boolean = {
-    Option(exception.getSQLState).exists(_.startsWith("42"))
+    exception.getSQLState match {
+      case "42000" | "42601" => true

Review Comment:
   **Non-blocking (P2):** PostgreSQL defines `42000` as the combined 
`syntax_error_or_access_rule_violation` condition, while `42601` is the 
syntax-specific condition. Since `isSyntaxErrorBestEffort` guarantees that 
every `true` result is a syntax error and JDBCRDD uses it to replace the 
original exception with `JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR`, an access-rule 
failure reported as `42000` is still mislabeled here. Could we match only 
`42601` and change the unit coverage so an access-rule-flavored `42000` is 
asserted false?



-- 
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]

Reply via email to