function resetSequence($sequence)
{
// Get the minimum value of the sequence
$seq = $this->getSequence($sequence);
if ($seq->recordCount() != 1) {
return -1;
}
$minvalue = $seq->fields['min_value'];
$f_schema = $this->_schema;
$this->fieldClean($f_schema);
/* This double-cleaning is deliberate */
$this->fieldClean($sequence);
$this->clean($sequence);
$sql = "SELECT pg_catalog.SETVAL('\"{$f_schema}\".\"{$sequence}\"', {$minvalue})";
return $this->execute($sql);
}