Re: function side effects

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Tatsuo Ishii <ishii(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: function side effects
Date: 2010-03-01 21:40:40
Message-ID: 4B8C3458.80701@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jaime Casanova írta:
> On Mon, Mar 1, 2010 at 2:56 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>
>> On tis, 2010-02-23 at 16:54 -0500, Jaime Casanova wrote:
>>
>>> On Tue, Feb 23, 2010 at 2:02 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>
>>>> There may be some value in inventing a "has no side effects" marker, but
>>>> that should not be confused with IMMUTABLE/STABLE.
>>>>
>>>>
>>> a READONLY function?
>>>
>> SQL standard:
>>
>> <SQL-data access indication> ::=
>> NO SQL
>> | CONTAINS SQL
>> | READS SQL DATA
>> | MODIFIES SQL DATA
>>
>>
>
> good!
>
>
>> Notice also that this is separate from
>>
>> <deterministic characteristic> ::=
>> DETERMINISTIC
>> | NOT DETERMINISTIC
>>
>>
>
> so IMMUTABLE = DETERMINISTIC NO SQL,
> STABLE = DETERMINISTIC READS SQL DATA
> VOLATILE = NOT DETERMINISTIC MODIFIES SQL DATA
>
>
>> which is the SQL standard's variant of volatility.
>>
>> So someone has already had the idea that these two should exist
>> separately.
>>
>>
>
> seems something we should implement
>

At least the combinations to recognize the current
IMMUTABLE/STABLE/VOLATILE features.
By definition, READS SQL DATA and MODIFIES SQL DATA
cannot be DETERMINISTIC. But I can imagine some C and
PL/Perl functions that are NOT DETERMINISTIC NO SQL.

And what does "CONTAINS SQL" mean? Is it distinct from
the other two READS/MODIFIES SQL DATA markers?
"SELECT CURRENT_TIMESTAMP" may be an example
but it doesn't seem to be significantly different from
$$SELECT $1 || $2;$$ LANGUAGE SQL or the same
written in PL/Perl or C.

Best regards,
Zoltán Böszörményi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-03-01 21:43:41 Re: scheduler in core
Previous Message Tom Lane 2010-03-01 21:35:49 Re: double and numeric conversion