Beispiel #1
0
        public static QsiViewDefinitionNode VisitCreateMaterializedViewStatement(CreateMaterializedViewStatementContext context)
        {
            var node = new QsiViewDefinitionNode
            {
                Identifier = context.cf.id
            };

            node.Source.SetValue(TableVisitor.VisitCommonSelectStatement(new CommonSelectStatementContext(context)));

            CqlTree.PutContextSpan(node, context);

            return(node);
        }
Beispiel #2
0
        public IQsiDefinitionNode VisitCreateTableAsStmt(CreateTableAsStmt stmt)
        {
            if (stmt.relkind != ObjectType.OBJECT_MATVIEW)
            {
                throw TreeHelper.NotSupportedTree($"{nameof(CreateTableAsStmt)}({stmt.relkind})");
            }

            var node = new QsiViewDefinitionNode
            {
                Identifier = IdentifierVisitor.VisitRangeVar(stmt.into[0].rel[0]),
                Source     = { Value = TableVisitor.Visit(stmt.query[0]) }
            };

            if (stmt.if_not_exists ?? false)
            {
                node.ConflictBehavior = QsiDefinitionConflictBehavior.Ignore;
            }

            return(node);
        }