上一页 1 ··· 91 92 93 94 95 96 97 98 99 ··· 104 下一页
摘要: 接上文,从 simple_select 中的 target_list ,再看target_list部分的内容:/***************************************************************************** * * target list for SELECT * ... 阅读全文
posted @ 2012-09-05 14:38 健哥的数据花园 阅读(542) 评论(0) 推荐(0) 编辑
摘要: simple_select: SELECT opt_distinct target_list into_clause from_clause where_clause group_clause having_clause window_clause { ... 阅读全文
posted @ 2012-09-05 14:29 健哥的数据花园 阅读(434) 评论(0) 推荐(0) 编辑
摘要: ./src/backend/parser/gram.y 中有如下的一段:opt_distinct: DISTINCT { $$ = list_make1(NIL); } | DISTINCT ON '(' expr_list ')' { $$ = $4; } | ALL { $$ = NIL; } | /*EMPTY*/ { $$ = NIL; } ; opt_sort_clause: sort_clause { $$ = $1;} | /*EMPTY*/ { $$ = NIL; ... 阅读全文
posted @ 2012-09-05 14:10 健哥的数据花园 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 对于PostgreSQL的语法分析,修改其 gram.y后,opt_distinct: DISTINCT { $$ = list_make1(NIL); } | DISTINCT ON '(' expr_list ')' { $$ = $4; } | ALL { $$ = NIL; } | /*EMPTY*/ { $$ = NIL; }simpl... 阅读全文
posted @ 2012-09-05 12:43 健哥的数据花园 阅读(739) 评论(0) 推荐(0) 编辑
摘要: 对于 select distinct on , 可以利用下面的例子来理解:create table a6(id integer, name varchar(10));insert into a6 values(1, ' 001');insert into a6 values(1, '002');insert into a6 values(2, '003');insert into a6 values(2, '004');select distinct on (id) id, name from a6;id | name---+-- 阅读全文
posted @ 2012-09-05 09:48 健哥的数据花园 阅读(3870) 评论(0) 推荐(0) 编辑
摘要: 目前,可以知道,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_mak... 阅读全文
posted @ 2012-09-04 13:47 健哥的数据花园 阅读(746) 评论(0) 推荐(0) 编辑
摘要: pgpool-II中凡是涉及到SQL文解析的部分,都是拷贝了 PostgreSQL的 raw_parser来完成的。而这时来自于 gram.y。psql 使用 了 psqlscan.l 和 gram.y 阅读全文
posted @ 2012-09-03 12:30 健哥的数据花园 阅读(478) 评论(0) 推荐(0) 编辑
摘要: 因为研究线程的资源释放问题,从网上学习了程序,并进行了改写。看代码:#include<pthread.h> #include<stdio.h> #include<unistd.h>using namespace std;pthread_key_t key; void echomsg(void* p){ int t= *(int*)p; printf("destructor excuted in thread %d, param=%d\n ",pthread_self(),t); } void* child1(void* arg){ int 阅读全文
posted @ 2012-08-29 09:04 健哥的数据花园 阅读(1333) 评论(0) 推荐(0) 编辑
摘要: pgpool-II3.1 里面,有一些比较奇怪的做法,至少目前在我看来,是画蛇添足。如果你没有声明 begin transaction 和 end/commit/rollback 。当你执行一个SQL文的时候,如果事前没有 begin transaction 之类的,它会在你所执行的单一的 update/insert/delete SQL 执行前,后,分别追加 BEGIN 和COMMIT。虽然我认为这个追加是没有必要的,只要交给后台数据库就好了,但是还是先来探讨一下其实现机理。具体是如何实现的呢。看代码:start_internal_transaction 函数/* * Start an in 阅读全文
posted @ 2012-08-29 09:00 健哥的数据花园 阅读(652) 评论(0) 推荐(0) 编辑
摘要: 客户问: pgpool-II3.1 的log 里面,为何会有Unable to parse 的信息?但是相关的SQL文却正确执行了的。为了探究原因,对代码进行了分析。首先最重要的是:pgpool-II对SQL文的分析,并没有什么特别的意义。它对自己不能解析的SQL文,都要报这个信息。但是pgpool-II不能解析,并不代表数据库端就不能识别。说到这里,得说一下:pgpool-II里面对log信息/debug信息的安排比较随意,不是很严谨。如果我们用 PPAS版里自带的 pgpool-II, 和PPAS数据库打交道的话,就会发现:很多从Oracle数据库移植过来的SQL文,可以被PPAS识别。却 阅读全文
posted @ 2012-08-29 08:18 健哥的数据花园 阅读(1398) 评论(0) 推荐(0) 编辑
上一页 1 ··· 91 92 93 94 95 96 97 98 99 ··· 104 下一页