pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Viktor Bojović <viktor.bojovic@gmail.com>
To: John <johnf@jfcomputer.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: strangest thing happened
Date: Thu, 8 Jul 2010 08:36:35 +0200
Message-ID: <AANLkTimC5ynngiCoibQjJ_2Oyrx77tpYW4kh6GVZV7_i@mail.gmail.com> (raw)
In-Reply-To: <201007071259.03294.johnf@jfcomputer.com>
References: <201007071259.03294.johnf@jfcomputer.com>

On Wed, Jul 7, 2010 at 9:59 PM, John <johnf@jfcomputer.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@postgresql.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

view thread (11+ messages)  latest in thread

Message-ID: <AANLkTimC5ynngiCoibQjJ_2Oyrx77tpYW4kh6GVZV7_i@mail.gmail.com>
Permalink:  ../AANLkTimC5ynngiCoibQjJ_2Oyrx77tpYW4kh6GVZV7_i@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTimC5ynngiCoibQjJ_2Oyrx77tpYW4kh6GVZV7_i@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: viktor.bojovic@gmail.com, johnf@jfcomputer.com
  Subject: Re: strangest thing happened
  In-Reply-To: <AANLkTimC5ynngiCoibQjJ_2Oyrx77tpYW4kh6GVZV7_i@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox