X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A85235E4813 for ; Mon, 6 Sep 2004 11:05:08 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 44154-09 for ; Mon, 6 Sep 2004 10:05:06 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 58CF45E4844 for ; Mon, 6 Sep 2004 11:05:03 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i86A52Cn048991 for ; Mon, 6 Sep 2004 10:05:02 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i869dmAq040372 for pgsql-admin@postgresql.org; Mon, 6 Sep 2004 09:39:48 GMT From: Kostis Mentzelos X-Newsgroups: comp.databases.postgresql.admin Subject: Re: duplicates Date: Mon, 06 Sep 2004 12:40:55 +0300 Organization: Hub.Org Networking Services Lines: 28 Message-ID: References: <008601c493e5$e0965940$0b00a8c0@forge> <00c701c493eb$def5b9e0$0b00a8c0@forge> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en In-Reply-To: To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/99 X-Sequence-Number: 14802 Tsirkin Evgeny wrote: > yes i understand that i can create a primary key/unique etc... > however my question is if i have to understand if and why > the i got duplicate rows inserted. > so here is the picture: > an application is deleting rows and inserting right after that > new ones some of which are the same as the old one,and i am getting > duplicates !Don't transaction should prevent this by not letting > insert ot do something in case the delete did not succeed? > Another option is that i have to clients deleting and then inserting the > same thing into table ,but again should not transaction prevent duplicates > in that case ? > > >>Use something like this: >> >> CREATE TABLE schedule ( >> id serial PRIMARY KEY, >> studentid decimal(9), >> groupid decimal(10), >> maslulsignid decimal(7), >> tfusot varchar(29) >> ); >> > > > No, you should lock the table.