Skip to content

Commit

Permalink
Query for view explicitly when QualifiedObjectName is present
Browse files Browse the repository at this point in the history
When QualifiedObjectName is present it is possible to
query for view explicitly instead of listing
all views in schema.
  • Loading branch information
sopel39 committed Aug 27, 2019
1 parent d189247 commit dc2fc6e
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,13 @@ public List<QualifiedObjectName> listViews(Session session, QualifiedTablePrefix
{
requireNonNull(prefix, "prefix is null");

Optional<QualifiedObjectName> objectName = prefix.asQualifiedObjectName();
if (objectName.isPresent()) {
return getView(session, objectName.get())
.map(handle -> ImmutableList.of(objectName.get()))
.orElseGet(ImmutableList::of);
}

Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, prefix.getCatalogName());

Set<QualifiedObjectName> views = new LinkedHashSet<>();
Expand Down

0 comments on commit dc2fc6e

Please sign in to comment.