Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Pavan Deolasee
On Tue, Jul 23, 2013 at 4:51 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andres Freund and...@2ndquadrant.com 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

Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Tom Lane
Pavan Deolasee pavan.deola...@gmail.com 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,

Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Pavan Deolasee
On Thu, Jul 25, 2013 at 6:43 PM, Tom Lane t...@sss.pgh.pa.us 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()) ...

Re: [HACKERS] Expression indexes and dependecies

2013-07-25 Thread Tom Lane
Pavan Deolasee pavan.deola...@gmail.com writes: On Thu, Jul 25, 2013 at 6:43 PM, Tom Lane t...@sss.pgh.pa.us 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

[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

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 for

Re: [HACKERS] Expression indexes and dependecies

2013-07-22 Thread Claudio Freire
On Mon, Jul 22, 2013 at 6:04 PM, Alvaro Herrera alvhe...@2ndquadrant.com 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

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 find that in

Re: [HACKERS] Expression indexes and dependecies

2013-07-22 Thread Tom Lane
Andres Freund and...@2ndquadrant.com 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