[#5309] [#7518] Wrong parser implementation

This commit is contained in:
lukaseder 2019-01-31 16:30:14 +01:00
parent d1e2abd1ab
commit 51759a6cee
2 changed files with 19 additions and 16 deletions

View File

@ -654,22 +654,24 @@ final class CreateTableImpl extends AbstractQuery implements
}
}
private final void acceptSelectInto(Context<?> ctx) {
if (FALSE.equals(withData))
ctx.data(DATA_SELECT_NO_DATA, true);
ctx.data(DATA_SELECT_INTO_TABLE, table);
if (!columnFields.isEmpty())
ctx.visit(select(asterisk()).from(table(select).as(table(name("t")), columnFields.toArray(EMPTY_FIELD))));
else
ctx.visit(select);
ctx.data().remove(DATA_SELECT_INTO_TABLE);
if (FALSE.equals(withData))
ctx.data().remove(DATA_SELECT_NO_DATA);
}
private enum OnCommit {
DELETE_ROWS,

View File

@ -2874,10 +2874,11 @@ final class ParserImpl implements Parser {
Name fieldName = parseIdentifier(ctx);
DataType<?> type = null;
if (ctas == null && (peek(ctx, ',') || peek(ctx, ')')))
ctas = true;
else
ctas = false;
if (ctas == null)
if (peek(ctx, ',') || peek(ctx, ')'))
ctas = true;
else
ctas = false;
type = !TRUE.equals(ctas)
? parseDataType(ctx)