From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
Cc: | Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: COPY and Volatile default expressions |
Date: | 2013-04-16 12:57:15 |
Message-ID: | 516D4AAB.3000809@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 16.04.2013 14:38, Simon Riggs wrote:
> On 15 April 2013 21:53, Simon Riggs<simon(at)2ndquadrant(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2013-04-16 13:37:33 | Re: COPY and Volatile default expressions |
Previous Message | Robert Haas | 2013-04-16 11:49:47 | Re: event trigger API documentation? |