Re: COPY and Volatile default expressions - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: COPY and Volatile default expressions
Date
Msg-id CA+U5nMJbmCw+dR5AEpr2M7vPkmVtBK2DKXOGMbD0BOKfn7n0og@mail.gmail.com
Whole thread Raw
In response to Re: COPY and Volatile default expressions  (Jaime Casanova <jaime@2ndquadrant.com>)
Responses Re: COPY and Volatile default expressions
List pgsql-hackers
On 15 April 2013 21:32, Jaime Casanova <jaime@2ndquadrant.com> wrote:
> On Mon, Apr 15, 2013 at 3:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>
>> OTOH, the notion that a UUID generator doesn't touch *any* database
>> state seems like it might be worth treating as a general function
>> property: it's simple to understand and applies to a lot of other
>> volatile functions such as random() and clock_timestamp().
>>
>
> Something like the NO SQL access indication mandated by sql standard?
>
> http://www.postgresql.org/message-id/1267473390.7837.9.camel@vanquo.pezone.net

That would work for UUIDs, random() etc but not for sequences.

So I'll treat this as two separate cases:
* add special case for sequences
* use the NO SQL mechanism, as described, which implies no reads or
writes of database state. We could test that, but its somewhat harder
and we'd need to test for that on entry to any function, which I don't
much like.

Default to current timestamp is also a common use case - thanks for
mentioning that.

Doing it tha way Tatsuo would be able to parse functions more easily
as requested in the linked post.

--Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Rodrigo Barboza
Date:
Subject: Re: Query not using index for user defined type
Next
From: "anarazel@anarazel.de"
Date:
Subject: Re: Why are JSON extraction functions STABLE and not IMMUTABLE?