Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ public void createTable(ConnectorSession session, ConnectorTableMetadata tableMe
@Override
public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, ConnectorTableMetadata tableMetadata, Optional<ConnectorTableLayout> layout, RetryMode retryMode)
{
if (retryMode != RetryMode.NO_RETRIES) {
throw new TrinoException(NOT_SUPPORTED, "This connector does not support query retries");
}
return createTable(session, tableMetadata);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,25 @@ public void testTableNameClash()
}
}

@Test
public void testCreateSchema()
{
String schemaName = "Test_Create_Case_Sensitive_" + randomTableSuffix();
assertUpdate("CREATE SCHEMA " + schemaName.toLowerCase(ENGLISH));
assertQuery(format("SELECT schema_name FROM information_schema.schemata WHERE schema_name = '%s'", schemaName.toLowerCase(ENGLISH)), format("VALUES '%s'", schemaName.toLowerCase(ENGLISH)));
assertUpdate("DROP SCHEMA " + schemaName.toLowerCase(ENGLISH));
Comment on lines +232 to +235
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hashhar does this test have sense within CaseInsensitiveMapping class since all occurrences can be extracted
String lowerCase = schemaName.toLowerCase(ENGLISH);
and used through out the method?

}

@Test
public void testCreateSchemaNameClash()
throws Exception
{
String schemaName = "Test_Create_Case_Sensitive_Clash_" + randomTableSuffix();
try (AutoCloseable schema = withSchema(schemaName)) {
assertQueryFails("CREATE SCHEMA " + schemaName.toLowerCase(ENGLISH), ".*Schema 'bigquery\\.\\Q" + schemaName.toLowerCase(ENGLISH) + "\\E' already exists");
}
}

@Test
public void testDropSchema()
throws Exception
Expand Down