Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XSCOS-0001sS-FF for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Sep 2014 21:59:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XSCOR-0003l1-Uk for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Sep 2014 21:59:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XSCOQ-0003jT-Qz for pgsql-bugs@postgresql.org; Thu, 11 Sep 2014 21:59:06 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XSCON-0005OM-AX for pgsql-bugs@postgresql.org; Thu, 11 Sep 2014 21:59:05 +0000 MIME-Version: 1.0 Subject: BUG #11402: Prepared statement cache invalidation and unknown types To: pgsql-bugs@postgresql.org From: marko@joh.to Date: Thu, 11 Sep 2014 21:58:05 +0000 Message-ID: <20140911215805.2484.10673@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 The following bug has been logged on the website: Bug reference: 11402 Logged by: Marko Tiikkaja Email address: marko@joh.to PostgreSQL version: 9.4beta2 Operating system: Any Description: Hi, This might have been reported before, but I hit this quite horrible behaviour with prepared statements this week. Observeth: local:marko=# create table foo(a int); CREATE TABLE local:marko=#* prepare qwr(unknown) as select * from foo where a = $1; PREPARE local:marko=#* execute qwr('1'); a --- (0 rows) local:marko=#* alter table foo alter column a type text; ALTER TABLE local:marko=#* execute qwr('1'); ERROR: operator does not exist: text = integer HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. I hit the behaviour on 9.1 originally with functions, but tested it against a reasonably fresh HEAD and it was still broken. Somehow it seems that the prepared statement isn't willing to forget the data type of the argument after it has been resolved once (even though it was specified to be unknown :-( ). This leads to some grotesque cache invalidation code in our API. If this has been discussed before and has been decided to not be worth fixing, feel free to call me names, but I just thought I'd bring it to your attention before I forget again. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs