function side effects - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject function side effects
Date
Msg-id 20100223.125149.28784519.t-ishii@sraoss.co.jp
Whole thread Raw
Responses Re: [SPAM]function side effects
Re: function side effects
Re: function side effects
Re: function side effects
List pgsql-hackers
Hi,

I'm wondering if we could detect a funcion has a side effect,
i.e. does a write to database. This is neccessary for pgpool to decide
if a qeury should to be sent to all of databases or not. If a query
includes functions which do writes to database, it should send the
query to all of databases, otherwise the contents of databases go into
inconsistent state.

Currently we have three properties of functions: IMMUTABLE, STABLE and
VOLATILE. According to docs IMMUTABLE or STABLE functions do not write
to database. VOLATILE functions *may* do writes to database. Maybe I
could regard VOLATILE functions always do write, but priblem is,
VOLATILE qfunctions such as random() and timeofday() apparently do not
write and sending those queries that include such functions is
overkill.

Can we VOLATILE property divide into two categories, say, VOLATILE
without write, and VOLATILE with write?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Elementary dependency look-up
Next
From: Jaime Casanova
Date:
Subject: synchronous commit in dump