From: Markus Schaber <schabi@logix-tt.com>
To: Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>
Cc: pgsql-sql@postgresql.org
Subject: Re: deleting rows in specific order
Date: Fri, 13 Oct 2006 13:48:12 +0200
Message-ID: <452F7CFC.50009@logix-tt.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0610112108100.16984@mazsola.iit.uni-miskolc.hu>
References: <Pine.LNX.4.61.0610092207210.24332@mazsola.iit.uni-miskolc.hu>
<452CE81A.5010001@logix-tt.com>
<Pine.LNX.4.61.0610112108100.16984@mazsola.iit.uni-miskolc.hu>
Hi, Daniel,
Daniel Drotos wrote:
>> What is it that you're trying to achieve with the ordered delete? Maybe
>> there's a better way to solve your underlying problem.
>
> I've a table which has a field for some info (number) and a date field
> (insertion date) and others.
>
> After inserting new rows into this table, very old rows are going to be
> deleted. But value of deleted info should be remembered somehow, so
> there is a trigger on delete which keeps sum of the deleted info values
> in a separate table. This makes the application happy.
>
> Trigger's algorithm is a little bit more dificult which I would be able
> to simplify if rows are deleted in date order.
Ah, I see.
I don't know exactly what you're doing here, but at least for a sum, the
order of summed values is not relevant.
And due to the transaction system, other applications won't see
inconsistent intermediate states, as the whole DELETE run and all
trigger calls are part of the same transaction.
> Now I'm doing it in a plpgsql function using a `for in select loop' to
> delete rows one by one.
I'm afraid that this is the only solution if you can't simplify the
trigger by other means.
HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: schabi@logix-tt.com, drdani@mazsola.iit.uni-miskolc.hu
Subject: Re: deleting rows in specific order
In-Reply-To: <452F7CFC.50009@logix-tt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox