Re: INSERT before UPDATE? - Mailing list pgsql-general

From A. Kretschmer
Subject Re: INSERT before UPDATE?
Date
Msg-id 20070816123715.GA19295@a-kretschmer.de
Whole thread Raw
In response to INSERT before UPDATE?  (Jiří Němec <konference@menea.cz>)
List pgsql-general
am  Thu, dem 16.08.2007, um 14:11:07 +0200 mailte Ji??í N??mec folgendes:
> > see
> > http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE
>
> Yes I see, but I'll try to describe it in more detail:
>
> I could write plpgsql trigger function which will UPDATE a record (or
> INSERT new record) when the record is not found. But as far as I know
> a trigger is not executed when a updated record is not found, so this
> solution doesn't work for me. I don't want to change my application -
> I would like to set this behaviour directly in PostgreSQL database so
> I couldn't use a method from your example (...which requires that all
> SQL UPDATE statements need to be modified).

Maybe you can achieve this with a RULE.
I'm not sure, but i would try ist.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Yet Another COUNT(*)...WHERE...question
Next
From: "Phoenix Kiula"
Date:
Subject: Accessing tables in other databases, through functions