pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: cnliou9@fastmail.fm
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14483: Prepared statement does not re-plan while it should
Date: Mon, 02 Jan 2017 11:04:27 -0500
Message-ID: <16871.1483373067@sss.pgh.pa.us> (raw)
In-Reply-To: <20170102154014.10135.49515@wrigleys.postgresql.org>
References: <20170102154014.10135.49515@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

cnliou9@fastmail.fm writes:
> 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

This behavior is intentional: it's to keep applications from having to
deal with the possibility that they prepare a statement, Describe it
to find out what columns it returns, and then when they actually execute
it, it returns some other column set.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (5+ messages)  latest in thread

Message-ID: <16871.1483373067@sss.pgh.pa.us>
Permalink:  ../16871.1483373067@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16871.1483373067@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, cnliou9@fastmail.fm
  Subject: Re: BUG #14483: Prepared statement does not re-plan while it should
  In-Reply-To: <16871.1483373067@sss.pgh.pa.us>
  References: <20170102154014.10135.49515@wrigleys.postgresql.org> <16871.1483373067@sss.pgh.pa.us>

* 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