Re: [GENERAL] Sequence skipping values

2006-02-12 Thread Jean-Christophe Roux
Micheal,Thanks a lot for you very clear explanation. To solve the problem, I have created another table so that the table does not use a rule to update itself. It works fine now.RegardsJCRMichael Fuhr <[EMAIL PROTECTED]> wrote: On Sat, Feb 11, 2006 at 06:06:21AM -0800, Jean-Christophe Roux wrote:>

Re: [GENERAL] Sequence skipping values

2006-02-11 Thread Michael Fuhr
On Sat, Feb 11, 2006 at 06:06:21AM -0800, Jean-Christophe Roux wrote: > Yes you are right, I did not show one rule on table topics: > CREATE OR REPLACE RULE topics_last_administrator_id AS > ON INSERT TO topics DO UPDATE topics SET last_administrator_id = > new.administrator_id > WHERE topi

Re: [GENERAL] Sequence skipping values

2006-02-11 Thread Jean-Christophe Roux
Hi Michael,I'm running PostgreSQL 7.4.5 on a shared wehosting, which means among other things that I have limited control over the database settings and capabilities, For instance, I cannot install languages and therefore I cannot write triggers.Yes you are right, I did not show one rule on t

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Michael Fuhr
On Fri, Feb 10, 2006 at 08:10:36PM -0800, Jean-Christophe Roux wrote: > here are the structures of the table involved: I couldn't duplicate the problem in 8.1.2 or 8.0.6 with the code you posted. I created the given tables and rules (plus guesses for the administrators and status_list tables), th

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Jean-Christophe Roux
Hi here are the structures of the table involved:CREATE TABLE topics(  topic_id int8 NOT NULL DEFAULT nextval('topics_id_seq'::text),  datetime timestamp NOT NULL DEFAULT ('now'::text)::timestamp(6) with time zone,  topic text NOT NULL,  administrator_id int8 NOT NULL,  status_id int8 DEFAULT 0,  l

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Michael Fuhr
On Fri, Feb 10, 2006 at 03:27:23PM -0800, Jean-Christophe Roux wrote: > The table with the id not incrementing by 1 as I expected is named topics. > > I have three other tables that contain rules that on insert into those > tables, some fields of the table Topic should be updated. > Each of th

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Steve Crawford
Jean-Christophe Roux wrote: Hi, Thanks four your answers. Let me give more details here. The table with the id not incrementing by 1 as I expected is named topics. I have three other tables that contain rules that on insert into those tables, some fields of the table Topic should be updated. Eac

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Jean-Christophe Roux
Hi,Thanks four your answers. Let me give more details here.The table with the id not incrementing by 1 as I expected is named topics.I have three other tables that contain rules that on insert into those tables, some fields of the table Topic should be updated.Each of those three tables contain

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Michael Fuhr
On Fri, Feb 10, 2006 at 09:57:31AM -0800, Steve Crawford wrote: > There is no guarantee that a sequence will be contiguous. For example, > begin...insert into...rollback will not reset the sequence as other > transactions could have incremented the sequence. Also, deleting records won't modify

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Steve Crawford
Jean-Christophe Roux wrote: Hello, I have a table with and id field (primary key) which default value is the result of a sequence (increment explicitly set to 1). To my surprise, the real increment on insert is the total number of rows of the table. For instance, with 41 rows and a sequence l

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Scott Marlowe
On Fri, 2006-02-10 at 11:44, Jean-Christophe Roux wrote: > Hello, > I have a table with and id field (primary key) which default value is > the result of a sequence (increment explicitly set to 1). > To my surprise, the real increment on insert is the total number of > rows of the table. For insta

Re: [GENERAL] Sequence skipping values

2006-02-10 Thread Csaba Nagy
You likely roll back some transactions which insert. The sequence values don't get rolled back, once allocated, it's gone, even if you won't keep it. For concurrency/performance reasons sequence values are not transactional. Cheers, Csaba. On Fri, 2006-02-10 at 18:44, Jean-Christophe Roux wrote: