Skip to content
Advertisement

RETURNING rows using unnest()?

I’m trying to return a set of rows after doing UPDATE.

Something like this.

but postgres complains, rightly so:

set-valued function called in context that cannot accept a set

How am I supposed to go about implementing this?

That is, RETURNING a set of rows from SELECTed array after UPDATE?

I’m aware that a function can achieve this using RETURNS SETOF but rather prefer not to if possible.

Advertisement

Answer

Use WITH statement:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement