Re: [SQL] strangest thing happened

2010-07-08 Thread Torsten Zühlsdorff
Joe Conway schrieb: 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 t

Re: [SQL] strangest thing happened

2010-07-08 Thread Justin Graf
On 7/7/2010 5:41 PM, John wrote: > On Wednesday 07 July 2010 03:14:40 pm Justin Graf wrote: > >> I would be looking at the log files for the Inserts into that table as a >> means to track down what is the cause. If there are no log files or >> don't have enough detail, crank up the logging lev

Re: [SQL] strangest thing happened

2010-07-08 Thread Ben Morrow
Quoth jo...@jfcomputer.com (John): > On Wednesday 07 July 2010 03:14:40 pm Justin Graf wrote: > > I would be looking at the log files for the Inserts into that table as a > > means to track down what is the cause.  If there are no log files or > > don't have enough detail, crank up the logging leve

Re: [SQL] strangest thing happened

2010-07-07 Thread Viktor Bojović
On Wed, Jul 7, 2010 at 9:59 PM, John 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 ta

Re: [SQL] strangest thing happened

2010-07-07 Thread John
On Wednesday 07 July 2010 03:14:40 pm Justin Graf wrote: > I would be looking at the log files for the Inserts into that table as a > means to track down what is the cause.  If there are no log files or > don't have enough detail, crank up the logging level and wait for it to > happen again??? Th

Re: [SQL] strangest thing happened

2010-07-07 Thread Justin Graf
On 7/7/2010 3:42 PM, Ross J. Reedstrom wrote: > > Justin, you're missing that John reported that the sequences are > _behind_ the table. This only happens for me if I've been doing > bulk data loads. Then I use: > > select setval(sequence_name,max(serial_id_column)) from table_with_serial_id; > > Y

Re: [SQL] strangest thing happened

2010-07-07 Thread Joe Conway
On 07/07/2010 12:59 PM, John 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

Re: [SQL] strangest thing happened

2010-07-07 Thread Ross J. Reedstrom
On Wed, Jul 07, 2010 at 04:25:13PM -0500, Justin Graf wrote: > Are you using PG's sequence/auto increment??? > > If so. > Once PG fires off the nextval() for the sequence that number is > considered used and gone even if the transaction that called nextval() > is rolled back > > Depending on h

Re: [SQL] strangest thing happened

2010-07-07 Thread John
Yes I'm using auto_increment (serial data type). No function, method inserts PK's anywhere in my code. I'm thinking/guessing it had something to do with vacumn or the backup. I have been using Postgres for a number of years now and I never seen this in the past. So I'm really at a loss as ho

Re: [SQL] strangest thing happened

2010-07-07 Thread Justin Graf
Are you using PG's sequence/auto increment??? If so. Once PG fires off the nextval() for the sequence that number is considered used and gone even if the transaction that called nextval() is rolled back Depending on how the app is written nextval() might be called, but allow the User to cance

[SQL] strangest thing happened

2010-07-07 Thread John
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