Re: COPY and Volatile default expressions
От | Heikki Linnakangas |
---|---|
Тема | Re: COPY and Volatile default expressions |
Дата | |
Msg-id | 516D4AAB.3000809@vmware.com обсуждение исходный текст |
Ответ на | Re: COPY and Volatile default expressions (Simon Riggs <simon@2ndQuadrant.com>) |
Ответы |
Re: COPY and Volatile default expressions
|
Список | pgsql-hackers |
On 16.04.2013 14:38, Simon Riggs wrote: > On 15 April 2013 21:53, Simon Riggs<simon@2ndquadrant.com> wrote: > >> So I'll treat this as two separate cases: >> * add special case for sequences > > Patch attached. > > + if (IsA(node, FuncExpr)) > + { > + FuncExpr *expr = (FuncExpr *) node; > + > + /* > + * For this case only, we want to ignore the volatility of the > + * nextval() function, since some callers want this. nextval() > + * has no other args other than sequence name, so we can just > + * return false immediately in this case. > + */ > + if (expr->funcid == F_NEXTVAL_OID) > + return false; > + else if (func_volatile(expr->funcid) == PROVOLATILE_VOLATILE) > + return true; > + /* else fall through to check args */ > + } ... You still need to check the args, if the function is nextval, otherwise you incorrectly perform the optimization for something like "nextval(myvolatilefunc())". - Heikki
В списке pgsql-hackers по дате отправления: