Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Tom Lane
Pavan Deolasee writes: > On Thu, Jul 25, 2013 at 6:43 PM, Tom Lane wrote: >> More generally, I think the argument was that the behavior of a >> non-immutable CHECK would at least be easy to understand, assuming you >> know that the check will only be applied at row insertion or update. > But the

Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Pavan Deolasee
On Thu, Jul 25, 2013 at 6:43 PM, Tom Lane wrote: > > > Well, it's probably somewhat historical, but I doubt we'd want to > tighten it up now. Here's an example of a sensible CHECK that's > only stable: > > create ... last_update timestamptz check (last_update <= now()) ... > Agree. That

Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Tom Lane
Pavan Deolasee writes: > Ok. I will write up something and submit a patch. Constraints probably also > suffer from the same issue. Whats surprising is we don't mandate that the > functions used in CHECK constraint are immutable (like we do for indexes). > What that means is, even if a row was sati

Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Pavan Deolasee
On Tue, Jul 23, 2013 at 4:51 AM, Tom Lane wrote: > Andres Freund writes: > > On 2013-07-22 17:04:06 -0400, Alvaro Herrera wrote: > >> One way to attack this would be registering dependencies of a new kind > >> on functions used by index expressions. Then CREATE OR REPLACE function > >> could re

Re: [HACKERS] Expression indexes and dependecies

2013-07-22 Thread Tom Lane
Andres Freund writes: > On 2013-07-22 17:04:06 -0400, Alvaro Herrera wrote: >> One way to attack this would be registering dependencies of a new kind >> on functions used by index expressions. Then CREATE OR REPLACE function >> could reject alteration for such functions. I don't know if we care

Re: [HACKERS] Expression indexes and dependecies

2013-07-22 Thread Andres Freund
On 2013-07-22 17:04:06 -0400, Alvaro Herrera wrote: > Pavan Deolasee escribió: > > Hello, > > > > While doing some tests, I observed that expression indexes can malfunction > > if the underlying expression changes. > > [...] > > > Perhaps this is a known behaviour/limitation, but I could not fin

Re: [HACKERS] Expression indexes and dependecies

2013-07-22 Thread Claudio Freire
On Mon, Jul 22, 2013 at 6:04 PM, Alvaro Herrera wrote: > Pavan Deolasee escribió: >> Hello, >> >> While doing some tests, I observed that expression indexes can malfunction >> if the underlying expression changes. > > [...] > >> Perhaps this is a known behaviour/limitation, but I could not find th

Re: [HACKERS] Expression indexes and dependecies

2013-07-22 Thread Alvaro Herrera
Pavan Deolasee escribió: > Hello, > > While doing some tests, I observed that expression indexes can malfunction > if the underlying expression changes. [...] > Perhaps this is a known behaviour/limitation, but I could not find that in > the documentation. But I wonder if it makes sense to check

[HACKERS] Expression indexes and dependecies

2013-07-22 Thread Pavan Deolasee
Hello, While doing some tests, I observed that expression indexes can malfunction if the underlying expression changes. For example, say I define a function foo() as: CREATE OR REPLACE FUNCTION foo(a integer) RETURNS integer AS $$ BEGIN RETURN $1 + 1; END; $$ LANGUAGE plpgsql IMMUTABLE; I then