Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-05-04 Thread Merlin Moncure
On Fri, May 1, 2015 at 12:29 PM, Tom Lane wrote: > Robert Haas writes: >> On Fri, May 1, 2015 at 9:09 AM, Marko Tiikkaja wrote: >>> We recently hit a similar case in our production environment. What was >>> annoying about it is that there didn't seem to be a way for the application >>> to fix t

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-05-01 Thread Tom Lane
Robert Haas writes: > On Fri, May 1, 2015 at 9:09 AM, Marko Tiikkaja wrote: >> We recently hit a similar case in our production environment. What was >> annoying about it is that there didn't seem to be a way for the application >> to fix the issue by itself, short of reconnecting; even DISCARD

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-05-01 Thread Fabrízio de Royes Mello
Em sexta-feira, 1 de maio de 2015, Robert Haas escreveu: > On Fri, May 1, 2015 at 9:09 AM, Marko Tiikkaja > wrote: > > On 2015-04-28 19:43, Robert Haas wrote: > >> I guess > >> the root of the problem is that PL/plgsql's cache invalidation logic > >> only considers the pg_proc row's TID and xmin

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-05-01 Thread Robert Haas
On Fri, May 1, 2015 at 9:09 AM, Marko Tiikkaja wrote: > On 2015-04-28 19:43, Robert Haas wrote: >> I guess >> the root of the problem is that PL/plgsql's cache invalidation logic >> only considers the pg_proc row's TID and xmin when deciding whether to >> recompile. For base types that's probably

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-05-01 Thread Marko Tiikkaja
On 2015-04-28 19:43, Robert Haas wrote: I guess the root of the problem is that PL/plgsql's cache invalidation logic only considers the pg_proc row's TID and xmin when deciding whether to recompile. For base types that's probably OK, but for composite types, not so much. Thoughts? We recently

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-04-29 Thread Robert Haas
On Tue, Apr 28, 2015 at 3:59 PM, Tom Lane wrote: > Robert Haas writes: >> rhaas=# create table foo (a int); >> CREATE TABLE >> rhaas=# create or replace function test (x foo) returns int as $$begin >> return x.b; end$$ language plpgsql; >> CREATE FUNCTION >> rhaas=# alter table foo add column b i

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-04-28 Thread Tom Lane
Robert Haas writes: > rhaas=# create table foo (a int); > CREATE TABLE > rhaas=# create or replace function test (x foo) returns int as $$begin > return x.b; end$$ language plpgsql; > CREATE FUNCTION > rhaas=# alter table foo add column b int; > ALTER TABLE > rhaas=# select test(null::foo); > ERRO

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-04-28 Thread Merlin Moncure
On Tue, Apr 28, 2015 at 12:43 PM, Robert Haas wrote: > I hate to use the term "bug" for what somebody's probably going to > tell me is acceptable behavior, but that seems like a bug. I guess > the root of the problem is that PL/plgsql's cache invalidation logic > only considers the pg_proc row's

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-04-28 Thread Jim Nasby
On 4/28/15 12:58 PM, Pavel Stehule wrote: I hate to use the term "bug" for what somebody's probably going to tell me is acceptable behavior, but that seems like a bug. I guess the root of the problem is that PL/plgsql's cache invalidation logic only considers the pg_proc row's TI

Re: [HACKERS] cache invalidation for PL/pgsql functions

2015-04-28 Thread Pavel Stehule
2015-04-28 19:43 GMT+02:00 Robert Haas : > The following behavior surprised me, and a few other people at > EnterpriseDB, and one of our customers: > > rhaas=# create table foo (a int); > CREATE TABLE > rhaas=# create or replace function test (x foo) returns int as $$begin > return x.b; end$$ lang

[HACKERS] cache invalidation for PL/pgsql functions

2015-04-28 Thread Robert Haas
The following behavior surprised me, and a few other people at EnterpriseDB, and one of our customers: rhaas=# create table foo (a int); CREATE TABLE rhaas=# create or replace function test (x foo) returns int as $$begin return x.b; end$$ language plpgsql; CREATE FUNCTION rhaas=# alter table foo a