From: Michael P. <mic...@gm...> - 2011-04-27 09:03:01
|
Hi all, Please find attached a patch that adds support for DEFAULT nextval for XC. The main idea of this patch is to detect when a nextval function is used as default and replace the function expression of nextval by a constant expression when rewriting the query. I haven't yet run regressions on this patch, and I am still looking for a way to expand that for other non-immutable functions. The reason why I wanted to replace the value before planner was that we determine at planner level which node(s) to target, so rewriter looked to be a good place for that. Here is an example of query for this patch: create sequence toto; create table ab (a int default nextval('toto'), b int); insert into ab (b) values (2); insert into ab (b) values (2); insert into ab (b) values (2); template1=# select * from ab; a | b ---+--- 1 | 2 2 | 2 3 | 2 Any comments about this way of doing are welcome. -- Thanks, Michael Paquier http://michael.otacoo.com |