0

Hi I have a problem with 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...
                                                         ^

In my model I have

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;
}

What is strange is that in locale server everything is working... Any suggestion where to find the problem? Thanks

UPDATE:

If I do the same query directly,

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

everything is ok.

3
  • 1
    Perhaps demonstrate that you do really have a "users" table on the live server. Otherwise the message is pretty clear. Commented Aug 21, 2013 at 15:18
  • users exists on remote server Commented Aug 21, 2013 at 15:21
  • 2
    Then you are connecting as a different user, or to a different database, or the search-path is being fiddled with. Commented Aug 21, 2013 at 15:24

1 Answer 1

1

I found the problem.

The search-path of Postgresql was setted to another Schema and not to main schema "public"

Thanks to Richard!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.