带Postgresql的PDOException Zf2

时间:2013-08-21 15:10:42

标签: postgresql zend-framework2

嗨,我遇到了Zend Framework 2的问题。

File:
/home/marketplace/htdocs/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Statement.php:240
Message:
SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "users" does not exist
LINE 1: ...ELECT COUNT(1) AS "c" FROM (SELECT "users".* FROM "users") A...
                                                         ^

在我的模特中我有

public function fetchAll($paginated=false)
{
    if($paginated) {
        $select = new Select('users');
        $select->order('id DESC');
        $resultSetPrototype = new ResultSet();
        $resultSetPrototype->setArrayObjectPrototype(new User());
        $paginatorAdapter = new DbSelect(
            $select,
            $this->tableGateway->getAdapter(),
            $resultSetPrototype
        );
        $paginator = new Paginator($paginatorAdapter);
        return $paginator;
    }
    $resultSet = $this->tableGateway->select(function(Select $select){
        $select->limit('30')->order('id DESC');
    });
    return $resultSet;
}

奇怪的是,在locale服务器中一切正常...... 有什么建议在哪里找到问题? 感谢

更新

如果我直接进行相同的查询,

$sql = 'SELECT COUNT(1) AS "c" FROM (SELECT "users".* FROM "users") AS "original_select"';
$resultSet = $this->tableGateway->getAdapter()->query($sql);
return $resultSet; 

一切都很好。

1 个答案:

答案 0 :(得分:1)

我发现了问题。

Postgresql的搜索路径被设置为另一个架构而不是主架构“public”

感谢理查德!