Re: Missing feature - how to differentiate insert/update in plpgsql function?

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'depesz(at)depesz(dot)com'" <depesz(at)depesz(dot)com>, Pgsql General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Missing feature - how to differentiate insert/update in plpgsql function?
Date: 2017-02-15 14:58:08
Message-ID: A737B7A37273E048B164557ADEF4A58B539F9FF8@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hubert depesz lubaczewski wrote:
> I have a function, in PostgreSQL 9.6, which does:
>
> INSERT INTO table () values (...)
> ON CONFLICT DO UPDATE ...;
>
> The thing is that the function should return information whether the row
> was modified, or created - and currently it seems that this is not
> available. Or am I missing something?

Maybe the following answer can help:
http://stackoverflow.com/a/39204667/6464308

I don't really know how stable that (undocumented) behaviour will be, though.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2017-02-15 14:59:12 Re: Missing feature - how to differentiate insert/update in plpgsql function?
Previous Message hubert depesz lubaczewski 2017-02-15 14:53:46 Re: Missing feature - how to differentiate insert/update in plpgsql function?