Re: Unclear documentation (IMMUTABLE functions)
От | Daniel Schreiber |
---|---|
Тема | Re: Unclear documentation (IMMUTABLE functions) |
Дата | |
Msg-id | 200309051757.57259.daniel.schreiber@s1999.tu-chemnitz.de обсуждение исходный текст |
Ответ на | Re: Unclear documentation (IMMUTABLE functions) (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Unclear documentation (IMMUTABLE functions)
|
Список | pgsql-bugs |
Am Freitag, 5. September 2003 17:05 schrieb Tom Lane: > Daniel Schreiber <daniel.schreiber@s1999.tu-chemnitz.de> writes: > > A question on IMMUTABLE functions: do they only have to return the same > > value during a session/connection or during the databse server's > > lifetime? > > Lifetime, I'd say, since among other things IMMUTABLE is considered to > mean that it's okay to build an index on the function's results. > > Of course, you can cheat: the system makes no attempt to verify whether > a function that you say is IMMUTABLE really is. There are cases where > it's useful to lie about the mutability property of a function. What > you are basically controlling here is whether the planner will deem it > safe to pre-evaluate a call of the function. Unless you actually do > build a functional index using a function, I doubt it could matter > whether the results change from one session to the next. Okay, thanks, I think I got it now. > > I wrote a function that uses the CURRENT_USER session variable, and for > > my current usage it is very important, that it returns a different value > > for each database connection. > > CURRENT_USER is marked STABLE, not IMMUTABLE. Not sure what your point > is here. Okay, thanks for the help. I will rewrite the function as STABLE. Btw: is there documentation which parts in the environment are STABLE/IMMUTABLE? Thanks, Daniel Schreiber -- Daniel Schreiber | ICQ: 220903493 GPG encrypted Mail welcome! Key ID: 25A6B489 Chemnitzer Linux-Tag: http://www.tu-chemnitz.de/linux/tag/
В списке pgsql-bugs по дате отправления: