Skip to content
Advertisement

Tag: sql-returning

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

Variable value assignment using RETURNING clause

I try to do this, but it’s a syntax error, what am I doing wrong? my table: Answer You need to use the INTO clause in the RETURNING to set the value being returned into your variable: You also need to specify the data type of your variable; I’m glad to see postgresql supports %TYPE and %ROWTYPE.

Advertisement