[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-developers] Scheme Proc on sequence for postgresql
From: |
Michael Dean |
Subject: |
Re: [Phpgroupware-developers] Scheme Proc on sequence for postgresql |
Date: |
Thu, 23 Oct 2003 18:07:01 -0500 |
The short version is that the sequence needs to be updated to match the
table data after the new table is created and populated. The flow of
the function does not need to change. Try adding this before the final
return (beware of line wrapping):
// Update sequence to match
$sSeqField = '';
$this->GetSequenceFieldForTable($oProc, $sTableName, $sSeqField);
if ($sSeqField != '')
{
$sSeqName = '';
$this->GetSequenceForTable($oProc, $sTableName, $sSeqName);
if ($sSeqName != '')
{
// we have a sequence name and the corresponding field, so it
must be
golden
$sSQL = "SELECT SETVAL('$sSeqName', (SELECT MAX($sSeqField) FROM
$sTableName))";
$oProc->m_odb->query($sSQL);
}
}
On Thu, 2003-10-23 at 00:59, Edgar Luna wrote:
> Hi everyone.
>
> While testing the scripts for upgrade of contacts backend, we found
> that the algorithm for DropColumn is like this: