Re: [GENERAL] Missing feature - how to differentiate insert/update inplpgsql function? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: [GENERAL] Missing feature - how to differentiate insert/update inplpgsql function?
Date
Msg-id 02d8c251-ffd5-c270-46ce-a340c6f81dc5@aklaver.com
Whole thread Raw
In response to [GENERAL] Missing feature - how to differentiate insert/update in plpgsqlfunction?  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: [GENERAL] Missing feature - how to differentiate insert/updatein plpgsql function?  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-general
On 02/15/2017 06:05 AM, hubert depesz lubaczewski wrote:
> Hi,
> 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?

All I can think of is to use:

RETURNING pk

and see if that changed or not.

>
> Best regards,
>
> depesz
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: [GENERAL] Missing feature - how to differentiate insert/update in plpgsqlfunction?
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: [GENERAL] Missing feature - how to differentiate insert/updatein plpgsql function?