zoukankan      html  css  js  c++  java
  • PostgreSQL的语法分析的学习研究(一)

    目前,可以知道,PostgreSQL的词法分析和句法分析,用的也是flex 和bison。

    gram.y 就是用来生成 gram.c 的。

    为了验证一下,先分析 distinct 一段:

    /* We use (NIL) as a placeholder to indicate that all target expressions
    * should be placed in the DISTINCT list during parsetree analysis.
    */
    opt_distinct:
    DISTINCT { $$ = list_make1(NIL); }
    | DISTINCT ON '(' expr_list ')' { $$ = $4; }
    | ALL { $$ = NIL; }
    | /*EMPTY*/ { $$ = NIL; }
    ;

    改为:

    opt_distinct:
    DISTINCT { $$ = list_make1(NIL);

                       fprintf(stderr,"jian distinct"); 

                    }
    | DISTINCT ON '(' expr_list ')' { $$ = $4; }
    | ALL { $$ = NIL; }
    | /*EMPTY*/ { $$ = NIL; }
    ;

    通过psql 执行 :select distinct tid from a5;

    果然看见 后台出现信息:jian distinct。

  • 相关阅读:
    网页中的JavaScript
    css颜色表示
    css文本属性
    css2选择器
    css3选择器
    Canvas练习
    Canvas
    CSS样式之语法
    css基础1
    php操作成功返回当前页并刷新
  • 原文地址:https://www.cnblogs.com/gaojian/p/2670292.html
Copyright © 2011-2022 走看看