Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6395,6 +6395,12 @@
],
"sqlState" : "42P07"
},
"TEMP_VIEW_IF_NOT_EXISTS_NOT_ALLOWED" : {
"message" : [
"It is not allowed to define a TEMPORARY view with IF NOT EXISTS."
],
"sqlState" : "0A000"
},
"TEMP_VIEW_NAME_TOO_MANY_NAME_PARTS" : {
"message" : [
"CREATE TEMPORARY VIEW or the corresponding Dataset APIs only accept single-part view names, but got: <actualName>."
Expand Down Expand Up @@ -8022,11 +8028,6 @@
"CREATE VIEW with both IF NOT EXISTS and REPLACE is not allowed."
]
},
"_LEGACY_ERROR_TEMP_0053" : {
"message" : [
"It is not allowed to define a TEMPORARY view with IF NOT EXISTS."
]
},
"_LEGACY_ERROR_TEMP_0056" : {
"message" : [
"Invalid time travel spec: <reason>."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ private[sql] object QueryParsingErrors extends DataTypeErrorsBase {
}

def defineTempViewWithIfNotExistsError(ctx: CreateViewContext): Throwable = {
new ParseException(errorClass = "_LEGACY_ERROR_TEMP_0053", ctx)
new ParseException(errorClass = "TEMP_VIEW_IF_NOT_EXISTS_NOT_ALLOWED", ctx)
}

def notAllowedToAddDBPrefixForTempViewError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,15 @@ abstract class SQLViewSuite extends QueryTest with SQLTestUtils {

test("error handling: disallow IF NOT EXISTS for CREATE TEMPORARY VIEW") {
withTempView("myabcdview") {
val e = intercept[ParseException] {
sql("CREATE TEMPORARY VIEW IF NOT EXISTS myabcdview AS SELECT * FROM jt")
}
assert(e.message.contains("It is not allowed to define a TEMPORARY view with IF NOT EXISTS"))
val sqlText = "CREATE TEMPORARY VIEW IF NOT EXISTS myabcdview AS SELECT * FROM jt"
checkError(
exception = intercept[ParseException] {
sql(sqlText)
},
condition = "TEMP_VIEW_IF_NOT_EXISTS_NOT_ALLOWED",
parameters = Map.empty,
context = ExpectedContext(sqlText, 0, sqlText.length - 1)
)
}
}

Expand Down