urosstan-db commented on code in PR #58621:
URL: https://github.com/apache/spark/pull/58621#discussion_r3972800300


##########
connector/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala:
##########
@@ -382,6 +385,46 @@ class PostgresIntegrationSuite extends 
SharedJDBCIntegrationSuite {
     assert(sql("select c1, c3 from queryOption").collect().toSet == 
expectedResult)
   }
 
+  test("SPARK-59336: do not classify missing table as a syntax error") {
+    val postgresError = intercept[SQLException] {
+      spark.read.format("jdbc")
+        .option("url", jdbcUrl)
+        .option("query", "SELECT * FROM table_that_does_not_exist")
+        .load()
+    }
+    assertResult("42P01")(postgresError.getSQLState)
+  }
+
+  test("SPARK-59336: do not classify insufficient privilege as a syntax 
error") {
+    val restrictedUser = "restricted_user"
+    val restrictedPassword = "restricted_password"
+    val restrictedJdbcUrl = 
s"jdbc:postgresql://$dockerIp:$externalPort/postgres"
+
+    Using.resource(getConnection()) { conn =>
+      conn.prepareStatement(s"CREATE USER $restrictedUser PASSWORD 
'$restrictedPassword'")

Review Comment:
   Good comment, but if create user fails, then there is nothing to clean, 
while after this `executeUpdate`, we will for sure execute `drop user`. I would 
not add drop user before create, since I like to have clean lifecycle, and we 
use docker container for each new run, even if we decide to reuse docker 
containers in CI in the future (highly unlike), we should be fine with 
execution of this test



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