Re: How to convert "output deleted/inserted into" in MySQL to Postgres

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to convert "output deleted/inserted into" in MySQL to Postgres
Date: 2015-02-20 21:07:39
Message-ID: 54E7A21B.3000807@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/20/2015 12:59 PM, Tong Michael wrote:
> I think it tried to update a couple of columns in table user and
> insert values in other 3 columns into another table ReconDeleted at
> the same time. I have issues converting "OUTPUT INTO" and "deleted"
> items, with my limited knowledge about Postgres, I don't think we have
> those in pg. Can someone tell me how to convert it? Thanks.

no idea what 'deleted' means, but, assuming this in is plpgsql, use
UPDATE .... RETURNING ...INTO rather than OUTPUT INTO,

http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW

now, if this in a trigger function, you can refer to OLD. and NEW.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael_LT 2015-02-20 21:41:23 Re: How to convert "output deleted/inserted into" in MySQL to Postgres
Previous Message Tong Michael 2015-02-20 20:59:30 How to convert "output deleted/inserted into" in MySQL to Postgres