Re: INSERT before UPDATE?

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: INSERT before UPDATE?
Date: 2007-08-16 12:37:15
Message-ID: 20070816123715.GA19295@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Phoenix Kiula 2007-08-16 12:48:07 Accessing tables in other databases, through functions
Previous Message Martijn van Oosterhout 2007-08-16 12:02:58 Re: Yet Another COUNT(*)...WHERE...question