摘要:
返回:Linux/Unix 索引页 #include <stdio.h> int main() { char *pst[3]={"Jan","Feb","Mar"}; int i; for (i=0; i<3;i++) printf("Array :%s\n", pst[i]); for (i=0; 阅读全文
摘要:
在 gram.y 中:simple_select: SELECT opt_distinct target_list into_clause from_clause where_clause group_clause having_clause window_clause { ... 阅读全文
摘要:
根据我的分析,其List 的定义,来自于:./src/include/pg_list.htypedef struct List{ NodeTag type; /*T_List, T_IntList or T_OidList*/ int length; ListCell *head; ListCell *tail;} List;是一个链表结构。*tail 指向下一个节点。 阅读全文
摘要:
PostgreSQL 的gram.y 中所说的 window_clause, 与 window 函数不同。是一定要出现在 语句最后的:create table a8(id integer, name varchar(10), salary integer); insert into a8 values(1, 'aa', 1000); insert into a8 values(2, 'bb', 3000); insert into a8 values(3, 'cc', 2000); insert into a8 values(4, 'dd 阅读全文
摘要:
create table test(id integer);insert into test values(1);insert into test values(3);insert into test values(6);insert into test values(10);insert into test values(15);insert into test values(24);------------------------------------------select id, lag(id, 1,0) from test;id lag1 03 16 310 6... 阅读全文
摘要:
用PostgreSQL给的例子,可以看得比较清楚:SELECT depname, empno, salary, rank() OVER (PARTITION BY depname ORDER BY salary DESC) FROM empsalary; depname | empno | salary | rank -----------+-------+--------+------ develop | 8 | 6000 | 1 develop | 10 | 5200 | 2 develop | 11 | 5200 | 2 ... 阅读全文
摘要:
create table a7(id integer, value integer);insert into a7 values(1,100);insert into a7 values(2,200);insert into a7 values(3,300);insert into a7 values(4,400);insert into a7 values(5,500);select id, value, cume_dist() over (order by id) as percent from a7;1 100 0.22 200 0.43 300 0.64 400 0.8... 阅读全文
摘要:
以例子来说明问题:create table salaries(id integer,sal integer,site varchar(4));insert into salaries values(1,100,'A');insert into salaries values(1,200,'A');insert into salaries values(2,300,'B');insert into salaries values(2,400,'B');insert into salaries values(3,500,'C& 阅读全文
摘要:
把target_list 中的这一段改变一下:| a_expr IDENT { $$ = makeNode(ResTarget); $$->name = $2; $$->indirection = NIL; $$->val = (Node *)$1; $$->location = @1; } 变... 阅读全文
摘要:
对于 gram.y 中, target_list 进一步理解:其中有如下一段:| a_expr IDENT { $$ = makeNode(ResTarget); $$->name = $2; $$->indirection = NIL; $$->val = (Node *)$1; $$->location = @1; } ... 阅读全文