Skip to content
Permalink
Browse files

Use name() instead of hand quoting sequence names.

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 ddc3eee84cc85eeabf51681ee501cbbd8818590a
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Model/Datasource/Database/Postgres.php
@@ -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.

@okinaka

okinaka Nov 19, 2014

Member

It seems not to use $quoted.

This comment has been minimized.

@markstory

markstory Nov 19, 2014

Author Member

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

}
}
return true;

0 comments on commit ddc3eee

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.