urosstan-db commented on code in PR #58621:
URL: https://github.com/apache/spark/pull/58621#discussion_r3958407881
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala:
##########
@@ -258,9 +258,12 @@ private case class PostgresDialect()
s" $indexType (${columnList.mkString(", ")}) $indexProperties"
}
+ // PostgreSQL class 42 contains both syntax errors and access rule
violations. SQLSTATE 42501
+ // is insufficient_privilege, which is an access error rather than a syntax
error.
// See https://www.postgresql.org/docs/current/errcodes-appendix.html
override def isSyntaxErrorBestEffort(exception: SQLException): Boolean = {
- Option(exception.getSQLState).exists(_.startsWith("42"))
+ val sqlState = exception.getSQLState
+ Option(sqlState).exists(_.startsWith("42")) && sqlState != "42501"
Review Comment:
We should be able to catch 42000 and 42601 only as syntax errors per
https://www.postgresql.org/docs/17/errcodes-appendix.html. Verify there is
integration test that covers wrong syntax query is classified correctly.
--
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]