Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cO56B-0007IP-Da for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Jan 2017 16:04:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cO56A-0004PR-IH for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Jan 2017 16:04:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cO56A-0004OS-1k for pgsql-bugs@postgresql.org; Mon, 02 Jan 2017 16:04:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cO567-0001gH-Do for pgsql-bugs@postgresql.org; Mon, 02 Jan 2017 16:04:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v02G4R4l016872; Mon, 2 Jan 2017 11:04:27 -0500 From: Tom Lane To: cnliou9@fastmail.fm cc: pgsql-bugs@postgresql.org 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> Comments: In-reply-to cnliou9@fastmail.fm message dated "Mon, 02 Jan 2017 15:40:14 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16870.1483373067.1@sss.pgh.pa.us> Date: Mon, 02 Jan 2017 11:04:27 -0500 Message-ID: <16871.1483373067@sss.pgh.pa.us> X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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