zoukankan      html  css  js  c++  java
  • 对PostgreSQL语法分析中 targetlist 的理解

    在 gram.y 中:

    simple_select:                                
                SELECT    opt_distinct    target_list                    
                into_clause     from_clause     where_clause                    
                group_clause     having_clause    window_clause                    
                    {                
                        SelectStmt *n = makeNode(SelectStmt);            
                        n->distinctClause = $2;            
                        n->targetList = $3;            
                        n->intoClause = $4;            
                        n->fromClause = $5;            
                        n->whereClause = $6;            
                        n->groupClause = $7;            
                        n->havingClause = $8;            
                        n->windowClause = $9;            
                        $$ = (Node *)n;            
                    }                
                                    
    ……       

    把它修改一下,增加:

    simple_select:                                
                SELECT    opt_distinct    target_list                    
                into_clause     from_clause     where_clause                    
                group_clause     having_clause    window_clause                    
                    {                
                        SelectStmt *n = makeNode(SelectStmt);            
                        n->distinctClause = $2;            
                        n->targetList = $3;            
                        n->intoClause = $4;            
                        n->fromClause = $5;            
                        n->whereClause = $6;            
                        n->groupClause = $7;            
                        n->havingClause = $8;            
                        n->windowClause = $9;            
                        $$ = (Node *)n;
                        fprintf(stderr,"length of list: %d\n", n->targetList->length);
                
                    }                
                                    
    ……                                 

    psql 中执行: select id, name from a8;

    后台出现: length of list: 2

  • 相关阅读:
    数据预处理 --Sklearn preprocessing的理解
    平衡二叉树的插入旋转
    二叉树
    malloc/free 与 new/delete的区别
    C/C++ const总结
    C/C++ static总结
    C++未定义行为
    c++虚函数表
    visual studio mfc中 cout 输出
    ERROR C4996 UNSAFE
  • 原文地址:https://www.cnblogs.com/gaojian/p/2673589.html
Copyright © 2011-2022 走看看