Skip to content

Commit

Permalink
TEIID-5366 correcting the sql string logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Jun 7, 2018
1 parent 71ca1ae commit e696b23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,11 @@ public void visit( MultipleElementSymbol obj ) {
if (obj.getGroup() == null) {
append(Tokens.ALL_COLS);
} else {
visitNode(obj.getGroup());
if (obj.getGroup().getDefinition() != null) {
append(escapeSinglePart(obj.getGroup().getName()));
} else {
visitNode(obj.getGroup());
}
append(Tokens.DOT);
append(Tokens.ALL_COLS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2973,6 +2973,15 @@ CreateProcedureCommand helpResolveUpdateProcedure(String procedure,
helpResolveException(sql);
}

@Test public void testTableAliasString() throws Exception {
String sql = "select \"pm1g2\".* from pm1.g1 as \"pm1g2\"";
Query query = (Query)helpResolve(sql);
UnaryFromClause ufc = (UnaryFromClause)query.getFrom().getClauses().get(0);
GroupSymbol gs = ufc.getGroup();
assertEquals("pm1g2", gs.getName());
assertEquals("SELECT pm1g2.* FROM pm1.g1 AS pm1g2", query.toString());
}

private void helpTestWidenToString(String sql) {
TransformationMetadata tm = RealMetadataFactory.exampleBQTCached().getDesignTimeMetadata();
tm.setWidenComparisonToString(false);
Expand Down

0 comments on commit e696b23

Please sign in to comment.