php - postgresql、pgpool 和 php 的游标错误

标签 php postgresql pdo pgpool

嘿,我正在努力确定在我们的发布环境中出现的错误的确切原因。在谷歌上似乎没有太多处理这个特定错误的方法。

这是我们得到的错误信息:

SQLSTATE[34000]: Invalid cursor name: 7 ERROR: portal "" does not exist

该错误仅在我们使用 PDO 准备语句时弹出。

这是我们发布环境的设置:

  1. pgpool 3.0.1(postgresql后端处于流复制模式!)
  2. PHP 5.3.5
  3. PostgreSQL 9.0

编辑:架构是 64 位的。

同样的错误并没有出现在我们的测试环境中(编辑:忘了说,标准测试环境使用没有 pgpool 的 Postgresql 9.0)。因此,我怀疑 pgpool 至少有一部分是可疑的。

有谁知道这个错误的可能原因是什么?

编辑:好的,这是导致错误的代码类型的示例。

$sql = 'SELECT * ';
$sql .= 'FROM "myTable" as "myStuff" ';
$sql .= 'WHERE "myTable"."status" = 1 ';
$sql .= 'AND "myTable"."myTableId" = :tableId ';
$sth = $this->_db->prepare($sql);
$sth->bindParam(':tableId', $tableId, PDO::PARAM_INT);
$sth->execute();

编辑:一些日志文件输出;

PostgreSQL:

postgresql-Sun.log-129- ORDER BY "id" 
postgresql-Sun.log:130:ERROR:  portal "" does not exist
postgresql-Sun.log-131-ERROR:  prepared statement "pdo_stmt_00000011" does not exist
postgresql-Sun.log-132-STATEMENT:  DEALLOCATE pdo_stmt_00000011


postgresql-Mon.log-82-  where "id" = 32024
postgresql-Mon.log:83:ERROR:  portal "" does not exist
postgresql-Mon.log-84-ERROR:  prepared statement "pdo_stmt_00000002" does not exist
postgresql-Mon.log-85-STATEMENT:  DEALLOCATE pdo_stmt_00000002

pgpool:

LOG:   pid 22071: Replication of node:1 is behind 2080 bytes from the primary server (node:0)
LOG:   pid 22071: Replication of node:2 is behind 2080 bytes from the primary server (node:0)
LOG:   pid 13499: pool_send_and_wait: Error or notice message from backend: : DB node id: 0 backend pid: 8470 statement:  message: portal "" does not exist
LOG:   pid 13499: pool_send_and_wait: Error or notice message from backend: : DB node id: 0 backend pid: 8470 statement: DEALLOCATE pdo_stmt_00000003 message: prepared statement "pdo_stmt_00000003" does not exist

最佳答案

我找到了解决方案。事实证明,我们遇到的这个错误在 Pgpool-II 3.1 alpha2 中并不存在。看起来这个错误在 3.0.3 发布后的 3 月份得到了修复。解决方案是下载版本并手动构建/安装。有些路径不同,例如配置路径是/usr/local/etc/

Pgpool-II 3.1 alpha2 可在此处获得: http://pgfoundry.org/frs/?group_id=1000055

最新的 3.0-Stable 树可能也修复了这个问题。我希望今晚晚些时候测试从 CVS 的导出。

关于php - postgresql、pgpool 和 php 的游标错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5959907/

相关文章:

php - 从 PHP 调用已编译的 C++ 可执行文件以创建套接字

json - 在 PostgreSQL 中的 Json 行中总结一个值

php - PDO 绑定(bind)参数问题

php - 启动新网站前的 SEO 问题

php - 使用 PhoneGap 将照片从 iPhone 上传到 PHP

php - Symfony 2 连接不工作主义和 MySQL

sql - 在 Postgresql 中返回自定义类型的表

sql - 在postgres中如何从事件日志类型表(具有时间戳)中获取特定时间范围内字段的总和(或汇总)

javascript - 使用php模态形式添加数据mySql

PHP 在 PDOStatement::bindParam 中绑定(bind)重载属性时注意