public void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) { // Resolve identifier as a table. final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolveTable(id.names, catalogReader.nameMatcher(), SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() != 1) { throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString())); } // We've found a table. But is it a sequence? final SqlValidatorNamespace ns = resolved.only().namespace; if (ns instanceof TableNamespace) { final Table table = ns.getTable().unwrap(Table.class); switch (table.getJdbcTableType()) { case SEQUENCE: case TEMPORARY_SEQUENCE: return; } } throw newValidationError(id, RESOURCE.notASequence(id.toString())); }
public void resolveTable(List<String> names, SqlNameMatcher nameMatcher, Path path, Resolved resolved) { parent.resolveTable(names, nameMatcher, path, resolved); }
public void resolveTable(List<String> names, SqlNameMatcher nameMatcher, Path path, Resolved resolved) { parent.resolveTable(names, nameMatcher, path, resolved); }
final List<String> names = SqlIdentifier.toStar(id.names); try { parentScope.resolveTable(names, nameMatcher, SqlValidatorScope.Path.EMPTY, resolved); } catch (CyclicDefinitionException e) { final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); parentScope.resolveTable(names, liberalMatcher, SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() == 1) {
final List<String> names = SqlIdentifier.toStar(id.names); try { parentScope.resolveTable(names, nameMatcher, SqlValidatorScope.Path.EMPTY, resolved); } catch (CyclicDefinitionException e) { final SqlNameMatcher liberalMatcher = SqlNameMatchers.liberal(); resolved.clear(); parentScope.resolveTable(names, liberalMatcher, SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() == 1) {
public void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) { // Resolve identifier as a table. final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolveTable(id.names, catalogReader.nameMatcher(), SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() != 1) { throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString())); } // We've found a table. But is it a sequence? final SqlValidatorNamespace ns = resolved.only().namespace; if (ns instanceof TableNamespace) { final Table table = ns.getTable().unwrap(Table.class); switch (table.getJdbcTableType()) { case SEQUENCE: case TEMPORARY_SEQUENCE: return; } } throw newValidationError(id, RESOURCE.notASequence(id.toString())); }
public void validateSequenceValue(SqlValidatorScope scope, SqlIdentifier id) { // Resolve identifier as a table. final SqlValidatorScope.ResolvedImpl resolved = new SqlValidatorScope.ResolvedImpl(); scope.resolveTable(id.names, catalogReader.nameMatcher(), SqlValidatorScope.Path.EMPTY, resolved); if (resolved.count() != 1) { throw newValidationError(id, RESOURCE.tableNameNotFound(id.toString())); } // We've found a table. But is it a sequence? final SqlValidatorNamespace ns = resolved.only().namespace; if (ns instanceof TableNamespace) { final Table table = ns.getTable().unwrap(Table.class); switch (table.getJdbcTableType()) { case SEQUENCE: case TEMPORARY_SEQUENCE: return; } } throw newValidationError(id, RESOURCE.notASequence(id.toString())); }