Re: [GENERAL] Problems with sequences

2006-09-07 Thread Kelly Burkhart
On 9/6/06, Arturo Perez <[EMAIL PROTECTED]> wrote: What happens is that if I do a select nextval('seq') I get a number that's lower than the max primary key id. This is inspite of my doing SELECT setval('seq', ((SELECT MAX(seq_ID) FROM table)+1)) ALTER SEQUENCE seq RESTART WITH ; select

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Arturo Perez
From: Alban Hertroys [mailto:[EMAIL PROTECTED] >Arturo Perez wrote: >> In any case, at this point in time it's looking like Cayenne doesn't honor >> the rules of the sequence. It appears to (and is documented as) internally >> incrementing rather than fetching the sequence for each insert. > >I ha

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Alban Hertroys
Arturo Perez wrote: In any case, at this point in time it's looking like Cayenne doesn't honor the rules of the sequence. It appears to (and is documented as) internally incrementing rather than fetching the sequence for each insert. I have no experience with Cayenne, but reading http://cwiki

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Alban Hertroys
Martijn van Oosterhout wrote: On Thu, Sep 07, 2006 at 07:15:43AM -0400, Arturo Perez wrote: iht=> select max(article_id) from article; max -- 4992 (1 row) iht=> select nextval('pk_article'); nextval - 4986 (1 row) Assuming the sequence number is being used correctly why would t

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Arturo Perez
From: Alban Hertroys [mailto:[EMAIL PROTECTED] >Martijn van Oosterhout wrote: >> On Thu, Sep 07, 2006 at 07:15:43AM -0400, Arturo Perez wrote: >>> iht=> select max(article_id) from article; >>> max >>> -- >>> 4992 >>> (1 row) >>> >>> iht=> select nextval('pk_article'); >>> nextval >>>

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Merlin Moncure
On 9/7/06, Arturo Perez <[EMAIL PROTECTED]> wrote: I tried statement logging but I am not sure it reported anything useful. When I get into work I'll send in those logs. More than likely they are large and should not be sent through the mailing list. contact me off list and I'll arrange it. m

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Martijn van Oosterhout
On Thu, Sep 07, 2006 at 07:15:43AM -0400, Arturo Perez wrote: > Note that all of the above was in an attempt to reset the sequence to > the proper value. I'm beginning to think that it's a library problem > as this morning I get: > > iht=> select max(article_id) from article; > max > -- >

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Arturo Perez
On Sep 7, 2006, at 5:35 AM, Alban Hertroys wrote: Arturo Perez wrote: What happens is that if I do a select nextval('seq') I get a number that's lower than the max primary key id. This is inspite of my doing SELECT setval('seq', ((SELECT MAX(seq_ID) FROM table)+1)) ALTER SEQUENCE seq RE

Re: [GENERAL] Problems with sequences

2006-09-07 Thread Alban Hertroys
Arturo Perez wrote: What happens is that if I do a select nextval('seq') I get a number that's lower than the max primary key id. This is inspite of my doing SELECT setval('seq', ((SELECT MAX(seq_ID) FROM table)+1)) ALTER SEQUENCE seq RESTART WITH ; select pg_catalog.setval(seq, , true)

Re: [GENERAL] Problems with sequences

2006-09-06 Thread Merlin Moncure
On 9/6/06, Arturo Perez <[EMAIL PROTECTED]> wrote: On Sep 6, 2006, at 8:48 PM, Merlin Moncure wrote: > On 9/6/06, Arturo Perez <[EMAIL PROTECTED]> wrote: >> What happens is that if I do a select nextval('seq') I get a number >> that's lower than the >> max primary key id. This is inspite of my

Re: [GENERAL] Problems with sequences

2006-09-06 Thread Arturo Perez
On Sep 6, 2006, at 8:48 PM, Merlin Moncure wrote: On 9/6/06, Arturo Perez <[EMAIL PROTECTED]> wrote: What happens is that if I do a select nextval('seq') I get a number that's lower than the max primary key id. This is inspite of my doing SELECT setval('seq', ((SELECT MAX(seq_ID) FROM tabl

Re: [GENERAL] Problems with sequences

2006-09-06 Thread Merlin Moncure
On 9/6/06, Arturo Perez <[EMAIL PROTECTED]> wrote: What happens is that if I do a select nextval('seq') I get a number that's lower than the max primary key id. This is inspite of my doing SELECT setval('seq', ((SELECT MAX(seq_ID) FROM table)+1)) ALTER SEQUENCE seq RESTART WITH ; select

Re: [GENERAL] Problems with sequences

2006-09-06 Thread Arturo Perez
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Scott Marlowe) wrote: > On Wed, 2006-09-06 at 16:56, Arturo Perez wrote: > > Hi all, > > > > My environment is Tomcat5.0, Cayenne 1.2 and PostgreSQL 8.1.4 on a > > RedHat ES3 machine. > > > > My webapplication is reusing sequence numbers and ge

Re: [GENERAL] Problems with sequences

2006-09-06 Thread Scott Marlowe
On Wed, 2006-09-06 at 16:56, Arturo Perez wrote: > Hi all, > > My environment is Tomcat5.0, Cayenne 1.2 and PostgreSQL 8.1.4 on a > RedHat ES3 machine. > > My webapplication is reusing sequence numbers and getting duplicate > primary key > failures because of it (error is "duplicate key violates

[GENERAL] Problems with sequences

2006-09-06 Thread Arturo Perez
Hi all, My environment is Tomcat5.0, Cayenne 1.2 and PostgreSQL 8.1.4 on a RedHat ES3 machine. My webapplication is reusing sequence numbers and getting duplicate primary key failures because of it (error is "duplicate key violates unique constraint"). The columns are not defined as SERIAL for