Re: A question of volatility

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: A question of volatility
Дата
Msg-id BAY113-W22BFDBED462A24F2F1741FF2740@phx.gbl
обсуждение исходный текст
Ответ на Re: A question of volatility  (Michael Glaesemann <grzm@seespotcode.net>)
Ответы Re: A question of volatility  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
>> If I have a couple of STABLE functions f1() and f2(), and then I
>> write a third function f3()
>> which does nothing other than call f1() and f2(), is it safe to
>> mark f(3) as IMMUTABLE?
>
> No. Why would calling two STABLE functions be IMMUTABLE? If it's
> going to be anything other than STABLE, it would be VOLATILE.
>
> Michael Glaesemann
> grzm seespotcode net
>

Thanks for that. I was afraid it would sound like a stupid question,
which is why I used the "novice" mailing list. I've only been using
Postgres a few weeks.

My reason for asking is that some languages maintain a dependency tree
of functions, and so could in theory do something clever with
dependent functions - such as distinguishing between *declared* and
*derived* volatility.

Example scenario - suppose I wrote an IMMUTABLE function calc_vat()
which multiplied its input by 0.175 (the VAT rate here in the UK) and
a whole library of other functions based on that. Then, some time
later, I decided that I would quite like to be able to vary the VAT
rate, so I made my calc_vat() function read from a table, making it
STABLE. What you're saying is that I would have to search through all
the functions in the database finding any that call calc_vat(), and
any that call those functions, and so on, making sure that they are
all at least STABLE.

Is there anything available that would help with that process? In
Oracle's PL/SQL, for example, after changing the function, I would
select from USER_OBJECTS, to find any functions which had been marked
invalid by my change.

Cheers, Dean.

_________________________________________________________________
The next generation of MSN Hotmail has arrived - Windows Live Hotmail
http://www.newhotmail.co.uk

В списке pgsql-novice по дате отправления:

Предыдущее
От: Andreas
Дата:
Сообщение: Re: How cast interval to minutes as number?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: A question of volatility