Bug in prepared statement cache invalidation?

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in prepared statement cache invalidation?
Date: 2017-04-28 07:01:22
Message-ID: 25dba024-9850-1dc1-bb18-1a82a6dd2c33@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

I find out that now Postgres correctly invalidates prepared plans which
directly depend on altered relation, but doesn't invalidate plans having
transitive (indirect) dependencies.
Is it a bug or feature?

postgres=# create table foo(x integer);
CREATE TABLE
postgres=# select * from foo;
x
---
(0 rows)

postgres=# create function returnqueryf()returns setof foo as $$ begin
return query select * from foo; end; $$ language plpgsql;
CREATE FUNCTION
postgres=# select * from returnqueryf();
x
---
(0 rows)

postgres=# create function returnqueryff()returns setof foo as $$ begin
return query select * from returnqueryf(); end; $$ language plpgsql;
CREATE FUNCTION
postgres=# select * from returnqueryff();
x
---
(0 rows)

postgres=# alter table foo add column y integer;
ALTER TABLE
postgres=# select * from foo;
x | y
---+---
(0 rows)

postgres=# select * from returnqueryf();
x | y
---+---
(0 rows)

postgres=# select * from returnqueryff();
ERROR: structure of query does not match function result type
DETAIL: Number of returned columns (1) does not match expected column
count (2).
CONTEXT: PL/pgSQL function returnqueryff() line 1 at RETURN QUERY
p

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2017-04-28 07:03:58 Re: Partition-wise aggregation/grouping
Previous Message Andrew Borodin 2017-04-28 06:17:57 Re: Merge join for GiST