Skip to content

Commit

Permalink
Use name() instead of hand quoting sequence names.
Browse files Browse the repository at this point in the history
By using name() we can easily accomodate postgres sequences that exist
out side of sequences.

Fixes #4168
  • Loading branch information
markstory committed Nov 18, 2014
1 parent f570f93 commit ddc3eee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Model/Datasource/Database/Postgres.php
Expand Up @@ -353,8 +353,8 @@ public function truncate($table, $reset = false) {
if ($this->execute('DELETE FROM ' . $this->fullTableName($table))) {
if (isset($this->_sequenceMap[$table]) && $reset != true) {
foreach ($this->_sequenceMap[$table] as $sequence) {
list($schema, $sequence) = explode('.', $sequence);
$this->_execute("ALTER SEQUENCE \"{$schema}\".\"{$sequence}\" RESTART WITH 1");
$quoted = $this->name($sequence);
$this->_execute("ALTER SEQUENCE {$sequence} RESTART WITH 1");

This comment has been minimized.

Copy link
@okinaka

okinaka Nov 19, 2014

Member

It seems not to use $quoted.

This comment has been minimized.

Copy link
@markstory

markstory Nov 19, 2014

Author Member

Yep, I am a dork. I will fix that tonight.

}
}
return true;
Expand Down

0 comments on commit ddc3eee

Please sign in to comment.