From: cnliou9@fastmail.fm
To: pgsql-bugs@postgresql.org
Subject: BUG #14483: Prepared statement does not re-plan while it should
Date: Mon, 02 Jan 2017 15:40:14 +0000
Message-ID: <20170102154014.10135.49515@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14483
Logged by: CN Liou
Email address: cnliou9@fastmail.fm
PostgreSQL version: 9.6.0
Operating system: Debian Wheezy
Description:
The documentation
file:///usr/share/doc/postgresql-doc-9.6/html/sql-prepare.html
says so:
"PostgreSQL will force re-analysis and re-planning of the statement before
using it whenever database objects used in the statement have undergone
definitional (DDL) changes since the previous use of the prepared statement.
Also, if the value of search_path changes from one use to the next, the
statement will be re-parsed using the new search_path. (This latter behavior
is new as of PostgreSQL 9.3.)"
==first test===
test=# CREATE TABLE x1 (c1 INTEGER);
CREATE TABLE
test=# PREPARE p1 AS SELECT * FROM x1;
PREPARE
(
Run this SQL in another session:
ALTER TABLE x1 ADD c2 TEXT;
)
test=# EXECUTE p1;
ERROR: cached plan must not change result type
==second test===
test=# SET SEARCH_PATH TO s1;
SET
test=# CREATE TABLE x2(c1 INTEGER);
CREATE TABLE
test=# PREPARE p2 AS SELECT * FROM x1;
PREPARE
test=# EXECUTE p2;
c1
----
(0 rows)
(
Run the following SQL's in another session:
test=# SET SEARCH_PATH TO s2;
SET
test=# CREATE TABLE x2(c1 INTEGER,c2 TEXT);
CREATE TABLE
)
test=# SET SEARCH_PATH TO s2;
SET
test=# EXECUTE p2;
ERROR: cached plan must not change result type
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: cnliou9@fastmail.fm
Subject: Re: BUG #14483: Prepared statement does not re-plan while it should
In-Reply-To: <20170102154014.10135.49515@wrigleys.postgresql.org>
References: <20170102154014.10135.49515@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox