Postgres:“错误:缓存的计划不得更改结果类型” [英] Postgres: "ERROR: cached plan must not change result type"

查看:692
本文介绍了Postgres:“错误:缓存的计划不得更改结果类型”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该异常由PostgreSQL 8.3.7服务器抛出到我的应用程序中。
有人知道此错误的含义是什么,我该怎么办?

This exception is being thrown by the PostgreSQL 8.3.7 server to my application. Does anyone know what this error means and what I can do about it?

ERROR:  cached plan must not change result type
STATEMENT:  select code,is_deprecated from country where code=$1


推荐答案

我找出了导致此错误的原因。

I figured out what was causing this error.

我的应用程序打开了数据库连接,并准备了一条SELECT语句以供执行。

My application opened a database connection and prepared a SELECT statement for execution.

同时,另一个脚本正在修改数据库表,更改上述SELECT语句中返回的列之一的数据类型。

Meanwhile, another script was modifying the database table, changing the data type of one of the columns being returned in the above SELECT statement.

我通过修改数据库表后重新启动应用程序来解决此问题。这将重置数据库连接,从而使准备好的语句得以正确执行。

I resolved this by restarting the application after the database table was modified. This reset the database connection, allowing the prepared statement to execute without errors.

这篇关于Postgres:“错误:缓存的计划不得更改结果类型”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆