Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.10.0
Description
For now, we can define computed column in create table ddl, but we can not add comment after it just like regular table column, So we should support it, it's grammar as follows:
col_name AS expr [COMMENT 'string']
My idea is, we can introduce class
SqlTableComputedColumn
to wrap name, expression and comment, And just get the element from it will be ok.
As for parserImpls.ftl, it can be like as follows:
identifier = SimpleIdentifier() <AS> expr = Expression(ExprContext.ACCEPT_NON_QUERY) [ <COMMENT> <QUOTED_STRING> { String p = SqlParserUtil.parseString(token.image); comment = SqlLiteral.createCharString(p, getPos()); }] { SqlTableComputedColumn tableComputedColumn = new SqlTableComputedColumn(identifier, expr, comment, getPos()); context.columnList.add(tableComputedColumn); }