From: | Janning Vygen <vygen(at)gmx(dot)de> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | table with sort_key without gaps |
Date: | 2004-12-09 17:32:19 |
Message-ID: | 200412091832.19728.vygen@gmx.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
i have a table like this:
create table array (
account text NOT NULL,
id int4 NOT NULL,
value text NOT NULL,
PRIMARY KEY (account, id)
);
values like this:
acc1,1,'hi'
acc1,2,'ho'
acc1,3,'ha'
acc2,1,'ho'
acc3,1,'he'
acc3,2,'hu'
"id" should be positive
"id" should not have gaps within the same account
"id" should start counting by 1 for each account
i cant use sequences because they are producing gaps and doesn't start
counting by 1 for each account and i dont want to use postgresql array type
for various reasons.
for this model to function you need a lot of sophisticated plpgsql function to
insert, move or delete entries to keep
- did anyone implemented a table like this and wrote some custom
functions/triggers for inserting, deleting, moving and so on? If yes it would
be nice if he/she is willing to sahre the code with me.
- did anyone implemented a table like this and came to the conclusion that
this shouldn't be done for any reasons out of my sight? (i don't bother about
updating a primary key)
kind regards,
janning
From | Date | Subject | |
---|---|---|---|
Next Message | Larry White | 2004-12-09 20:21:53 | using inheritance in production application. |
Previous Message | Jaime Casanova | 2004-12-09 16:09:55 | Re: migrating from informix |