Is it possible to get DISTINCT rows from RETURNING clause?

From: "Gnanakumar" <gnanam(at)zoniac(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Is it possible to get DISTINCT rows from RETURNING clause?
Date: 2011-02-17 07:05:51
Message-ID: 003d01cbce71$1eaf1c90$5c0d55b0$@com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Is it possible to get DISTINCT rows from an UPDATE statement using RETURNING
clause?

"MYTABLE" columns are:
APRIMARYKEYCOLUMN
ABOOLEANCOLUMN
EMAIL
COLUMN1
COLUMN2
COLUMN3

UPDATE using RETURNING clause query:
UPDATE MYTABLE SET ABOOLEANCOLUMN = true FROM MYTEMPTABLE WHERE EMAIL =
MYTEMPTABLE.EMAIL RETURNING EMAIL, COLUMN1, COLUMN2, COLUMN3;

Here in this case, I expect to return distinct rows from these columns:
EMAIL, COLUMN1, COLUMN2, COLUMN3.

I even tried out some ways of getting distinct rows, but it doesn't work.
Though I can still solve this at application layer, I'm trying to find
whether this could be controlled at query-level. Any different
ideas/suggestions are appreciated.

Regards,
Gnanam

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Forø Tollefsen 2011-02-17 14:20:10 ARRAY_AGG and COUNT
Previous Message Rok Jaklič 2011-02-16 22:34:38 Re: After insert trigger and select