Re: strangest thing happened

From: Viktor Bojović <viktor(dot)bojovic(at)gmail(dot)com>
To: John <johnf(at)jfcomputer(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: strangest thing happened
Date: 2010-07-08 06:36:35
Message-ID: AANLkTimC5ynngiCoibQjJ_2Oyrx77tpYW4kh6GVZV7_i@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Jul 7, 2010 at 9:59 PM, John <johnf(at)jfcomputer(dot)com> wrote:

> I am the only developer, DBA etc.. for a small project. Today (yesterday
> was
> everything was perfect) many of the sequence numbers fell behind what is
> the
> actual PK value. For example the invoice PK sequence current value = 1056
> but the table PK was 1071. Nobody (other than myself) knows how to
> edit/access the postgres server. So
>
> 1. Does anyone know how this could have happened?????? Other than human
> interaction.
>
> 2. Does anyone have a script to reset the sequences to match the tables?
>
> Thanks in advance,
>
> Johnf
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

John,

If the insert is performed to triggered table, and that trigger returns null
(doesn't insert) then the sequence will increment, but no data will be
inserted. If needed I will send you some code examples where it happened to
me many times.

Sincerely
--
---------------------------------------
Viktor Bojović
---------------------------------------
Wherever I go, Murphy goes with me

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message silly sad 2010-07-08 07:31:58 Re:
Previous Message Peter Koczan 2010-07-08 01:51:24 Re: tsearch2 and wildcards/pattern matching?