Re: BUG #14483: Prepared statement does not re-plan while it should

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: cnliou9(at)fastmail(dot)fm
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14483: Prepared statement does not re-plan while it should
Date: 2017-01-02 16:04:27
Message-ID: 16871.1483373067@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

cnliou9(at)fastmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-01-02 16:31:34 Re: Postgres returning in-correct results with ST_DWithin()
Previous Message David G. Johnston 2017-01-02 15:51:15 Re: BUG #14483: Prepared statement does not re-plan while it should