Skip site navigation (1) Skip section navigation (2)

Re: order of rows in update

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Achilleas Mantzios" <achill(at)matrix(dot)gatewaynet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: order of rows in update
Date: 2008-09-02 14:24:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
On Tue, Sep 2, 2008 at 2:58 AM, Achilleas Mantzios
<achill(at)matrix(dot)gatewaynet(dot)com> wrote:
> is there an (implicit) way to make a multirow update execute on some rows prior to other rows?
> It is needed in a case where a trigger is defined on the table as FOR EACH ROW, and it is mandatory
> that the trigger is run for some certain rows before it is run on the rest of the rows.
> Is there anything reliable to achieve this without making poor assumptions of the future
> versions, or should i just "SELECT ... ORDER BY ..." and then perform individual UPDATEs?

The only way that I know how to do this is to create a named cursor of
the rows that you want to update, and then for each record call

UPDATE ... FROM ... WHERE CURRENT OF cursorname;

But why are you even having this problem to begin with?  What you are
describing sounds like a database normalization problem.

Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)

In response to


pgsql-sql by date

Next:From: pwDate: 2008-09-02 21:14:47
Subject: How do I get min and max from an array of floating point values
Previous:From: Achilleas MantziosDate: 2008-09-02 09:58:36
Subject: order of rows in update

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group