Re: Question about IMMUTABLE function

From: "petrov(dot)boris(dot)v(at)mail(dot)ru" <petrov(dot)boris(dot)v(at)mail(dot)ru>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Question about IMMUTABLE function
Date: 2015-11-17 18:18:11
Message-ID: 564B6F63.9010100@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am sorry for posting that question. Documentation covers that:
"the immutability will be broken if the table contents ever change". I
should read more carefully.

On 11/17/2015 08:54 PM, petrov(dot)boris(dot)v(at)mail(dot)ru wrote:
> Hi
> Documentation states, that IMMUTABLE "... guaranteed to return the same
> results given the same arguments forever." My doubts are regarding
> 'forever' word.
> Q1: Can I safely mark as IMMUTABLE
> FUNCTION calc_col_gen_full_weburl(content_pages_table)
> Which is used in following context:
> SELECT p.id, p.calc_col_gen_full_weburl FROM content_pages_table;
> Given that:
> 1. It internally does SELECT. It looks at other rows in the same
> table (parent rows, to generate full url). And these rows may be updated
> some day. So it should return new value for row#5 if row#3 will be changed.
> 2. It in turn calls other function that is really IMMUTABLE (say
> my_char_replace()) and does not selects from anywhere. But, the
> implementation of that (my_char_replace()) function may be changed
> someday (it will be recreated).
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Shmagi Kavtaradze 2015-11-18 12:49:35 truncate data before importing
Previous Message petrov.boris.v@mail.ru 2015-11-17 17:54:42 Question about IMMUTABLE function