Re: Update in trigger

From: Iklódi Lajos <il(at)mithrandir(dot)hu>
To: Jan Wieck <janwieck(at)yahoo(dot)com>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>, William Meloney <bmeloney(at)mindspring(dot)com>
Subject: Re: Update in trigger
Date: 2002-04-04 03:41:22
Message-ID: 3CABCB62.6E94216@mithrandir.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Jan Wieck írta:

> Are there appropriate indexes on the table updated in the
> trigger and is the database "VACUUM ANALYZE"ed so the indexes
> get used?

There is a primary key.
VACUUM ANALYZE is really helpful, but only for a few minutes (3000 inserted
records).

William Meloney írta:

> Please forward a copy of the trigger. This is exactly the same thing I
> am trying to do but I have not had any success.

Here is the whole structure:

CREATE TABLE nyadat (
nykod serial primary key,
nymekod int4 not null references mekonf,
nyatip int4 not null references nyatip,
nymeido timestamp,
nytarido timestamp default now(),
nyhossz int4,
nyadat bytea
) ;

CREATE TABLE szm (
kod serial primary key,
konfx int4,
csatx int4,
dparx int4,
nparx int4,
nyugtax int4,
parancsx int4,
esemenyx int4,
kalibrx int4,
nyx int4,
feldx int4,
kparx int4
) ;

create function nyx_fnc() returns opaque as '
begin
update szm set nyx = new.nykod where kod=1 ;
return new ;
end ;
' language 'plpgsql' ;

create trigger ny_x_trig after insert
on nyadat for each row execute procedure nyx_fnc() ;

Thanks for any help.
Lajos

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Frank Joerdens 2002-04-04 07:00:01 Re: [SQL] bytea or large object
Previous Message Tom Lane 2002-04-04 03:33:34 Re: Cleaning up template 1 -> template0 cloning