Skip to content

Commit

Permalink
RD-11280: a schema does not exist error isn't reported to the user (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaidioz authored Aug 1, 2024
1 parent 87bde80 commit 5d81a44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ class NamedParametersPreparedStatement(
}

private def asErrorString(ex: PSQLException): Option[String] = {
if (Set("42", "22", "0A").exists(ex.getSQLState.startsWith)) {
if (Set("42", "22", "0A", "3F").exists(ex.getSQLState.startsWith)) {
// syntax error / semantic error
val psqlError = Option(ex.getServerErrorMessage) // getServerErrorMessage can be null!
val error = psqlError.map(_.getMessage).getOrElse(ex.getMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,4 +956,17 @@ class TestSqlCompilerServiceAirports
assert(v.messages.size == 1)
assert(v.messages(0).message == "non-executable code")
}

test("""select
| airport_id,
| city,
| country.name 'cname'
|from
| example.airports
|limit 10;
|""".stripMargin) { t =>
val v = compilerService.validate(t.q, asJson())
assert(v.messages.size == 1)
assert(v.messages(0).message == "schema \"country\" does not exist")
}
}

0 comments on commit 5d81a44

Please sign in to comment.