Patrick Maciel
Patrick Maciel

Reputation: 4944

Same nextval sequence with PostgreSQL 8.3

Setup


Problem

When I execute this query 2 twices, return the same value?

$sql = "select nextval('auth_num_seq') as nextval";
$nextval = $this->query($sql);

return $nextval[0][0]['nextval'];

Why?

I try that too, but doesn't work?

$sql = "select setval('auth_num_seq', nextval('auth_num_seq') + 1, false)";
$setval = $this->query($sql);

$sql = "select nextval('auth_num_seq') as nextval";
$nextval = $this->query($sql);

return $nextval[0][0]['nextval'];

Upvotes: 1

Views: 1198

Answers (1)

Patrick Maciel
Patrick Maciel

Reputation: 4944

I found the solution, in this link: http://cakephp.1045679.n5.nabble.com/how-to-disable-query-caching-td1297496.html

Thanks for AD7six!!

I need just do that: $this->query('some sql', false);. Set the second parameter as false.

Upvotes: 1

Related Questions