Re: MERGE ... RETURNING

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: MERGE ... RETURNING
Дата
Msg-id d414db4b-3ba2-ff3a-f994-1d4eb43c3f87@postgresfriends.org
обсуждение исходный текст
Ответ на Re: MERGE ... RETURNING  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: MERGE ... RETURNING  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
On 1/9/23 13:29, Dean Rasheed wrote:
> On Sun, 8 Jan 2023 at 20:09, Isaac Morland <isaac.morland@gmail.com> wrote:
>>
>> Would it be useful to have just the action? Perhaps "WITH ACTION"? My idea is that this would return an enum of
INSERT,UPDATE, DELETE (so is "action" the right word?). It seems to me in many situations I would be more likely to
careabout which of these 3 happened rather than the exact clause that applied. This isn't necessarily meant to be
insteadof your suggestion because I can imagine wanting to know the exact clause, just an alternative that might
sufficein many situations. Using it would also avoid problems arising from editing the query in a way which changes the
numbersof the clauses.
 
>>
> 
> Hmm, perhaps that's something that can be added as well. Both use
> cases seem useful.

Bikeshedding here.  Instead of Yet Another WITH Clause, could we perhaps 
make a MERGING() function analogous to the GROUPING() function that goes 
with grouping sets?

MERGE ...
RETURNING *, MERGING('clause'), MERGING('action');

Or something.
-- 
Vik Fearing




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dean Rasheed
Дата:
Сообщение: Re: [PATCH] random_normal function
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Make EXPLAIN generate a generic plan for a parameterized query