After delete worked and the a foreach execute update seems to work best.
Below is a satisfactory test set.
-- create test table
CREATE TABLE test1 (
a int,
b int,
c int);
-- create resort function
CREATE OR REPLACE FUNCTION resort_test1() RETURNS TRIGGER AS '
DECLARE
eachrow RECORD;
innerrow
.flash_id || '''';
sort := sort +1;
END IF;
END LOOP;
END LOOP;
RETURN OLD;
END;
' language 'plpgsql';
that I will rejigger to the test table and try out.
Thanks for the input.
From: Tom Lane <[EMAIL PROTECTED]
Stephan Szabo <[EMAIL PROTECTED]> writes:
> Is there anything we have right now that will handle this kind of thing
> without requiring either updating all the counts after a deletion in a
> statement trigger or once per row updating all the counts for records with
> the same "a" (doing something l
I suspect that if you read the spec carefully it would want a "triggered
data change violation" error raised here. My advice is not to use a
BEFORE trigger for this.
What would you recommend then. I am using Hibernate in my java application
and if the sort_order column (in this example colum
On Wed, 22 Jun 2005, Tom Lane wrote:
> Stephan Szabo <[EMAIL PROTECTED]> writes:
> >> CREATE TRIGGER u_test1 BEFORE DELETE ON portfolio.test1 FOR EACH ROW
> >> EXECUTE
> >> PROCEDURE resort_test1();
>
> > I think this will work in an after delete trigger, but not in a before
> > delete trigger (a
Stephan Szabo <[EMAIL PROTECTED]> writes:
>> CREATE TRIGGER u_test1 BEFORE DELETE ON portfolio.test1 FOR EACH ROW EXECUTE
>> PROCEDURE resort_test1();
> I think this will work in an after delete trigger, but not in a before
> delete trigger (and seems to in my tests). I'm not sure what the spec sa
On Wed, 22 Jun 2005, Russell Simpkins wrote:
> Hello,
>
> I have created a trigger function to update the sort_order column of a
> mapping table. I have table a that has a many to many relation ship with
> table b that is mapped as a_b where a_id, and b_id are the pk columns and
> there is a sort
Hello,
I have created a trigger function to update the sort_order column of a
mapping table. I have table a that has a many to many relation ship with
table b that is mapped as a_b where a_id, and b_id are the pk columns and
there is a sort_order column. Since a_b is a mapping table there are