Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed problems with resetSequence() not using the correct sequence name
in postgres
  • Loading branch information
lorenzo committed Oct 21, 2012
1 parent d4631a6 commit c00d58b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Cake/Model/Datasource/Database/Postgres.php
Expand Up @@ -287,7 +287,10 @@ public function getSequence($table, $field = 'id') {
if (is_object($table)) { if (is_object($table)) {
$table = $this->fullTableName($table, false, false); $table = $this->fullTableName($table, false, false);
} }
if (isset($this->_sequenceMap[$table]) && isset($this->_sequenceMap[$table][$field])) { if (!isset($this->_sequenceMap[$table])) {
$this->describe($table);
}
if (isset($this->_sequenceMap[$table][$field])) {
return $this->_sequenceMap[$table][$field]; return $this->_sequenceMap[$table][$field];
} else { } else {
return "{$table}_{$field}_seq"; return "{$table}_{$field}_seq";
Expand Down

0 comments on commit c00d58b

Please sign in to comment.