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 @@ -564,6 +564,10 @@ private void renameIndexTables(AccumuloTable oldTable, AccumuloTable newTable)

public void createView(SchemaTableName viewName, String viewData)
{
if (!tableManager.namespaceExists(viewName.getSchemaName())) {
throw new SchemaNotFoundException(viewName.getSchemaName());
}

if (getSchemaNames().contains(viewName.getSchemaName())) {
if (getViewNames(viewName.getSchemaName()).contains(viewName.getTableName())) {
throw new TrinoException(ALREADY_EXISTS, "View already exists");
Expand All @@ -579,6 +583,10 @@ public void createView(SchemaTableName viewName, String viewData)

public void createOrReplaceView(SchemaTableName viewName, String viewData)
{
if (!tableManager.namespaceExists(viewName.getSchemaName())) {
throw new SchemaNotFoundException(viewName.getSchemaName());
}

if (getView(viewName) != null) {
metaManager.deleteViewMetadata(viewName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,6 @@ public void testShowCreateTable()
")");
}

@Test
@Override
public void testCreateViewSchemaNotFound()
{
// TODO (https://github.com/trinodb/trino/issues/12475) Accumulo connector can create new views in a schema where it doesn't exist
assertThatThrownBy(super::testCreateViewSchemaNotFound)
.hasMessageContaining("Expected query to fail: CREATE VIEW test_schema_");
}

@Override
protected Optional<DataMappingTestSetup> filterDataMappingSmokeTestData(DataMappingTestSetup dataMappingTestSetup)
{
Expand Down