Permalink
Browse files

Fixed problems with resetSequence() not using the correct sequence name

in postgres
  • Loading branch information...
1 parent d4631a6 commit c00d58b4ef460c066ca5b161a5b2e8b127f5fc2d @lorenzo lorenzo committed Oct 21, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Cake/Model/Datasource/Database/Postgres.php
View
5 lib/Cake/Model/Datasource/Database/Postgres.php
@@ -287,7 +287,10 @@ public function getSequence($table, $field = 'id') {
if (is_object($table)) {
$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];
} else {
return "{$table}_{$field}_seq";

0 comments on commit c00d58b

Please sign in to comment.