Re: [BUGS] BUG #14483: Prepared statement does not re-plan while it should - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] BUG #14483: Prepared statement does not re-plan while it should
Date
Msg-id 16871.1483373067@sss.pgh.pa.us
Whole thread Raw
In response to [BUGS] BUG #14483: Prepared statement does not re-plan while it should  (cnliou9@fastmail.fm)
Responses Re: [BUGS] BUG #14483: Prepared statement does not re-plan while itshould
List pgsql-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

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [BUGS] BUG #14483: Prepared statement does not re-plan while it should
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] Postgres returning in-correct results with ST_DWithin()