Re: [GENERAL] plpgsql: UPDATE...Returning in FOR loop

2009-03-02 Thread Raymond O'Donnell
On 02/03/2009 20:19, Tom Lane wrote: > Well, that has nothing to do with UPDATE RETURNING; it's apparently > failing here: > >> rec recipients; > > I suppose "recipients" is a composite type one of whose columns is of a > NOT NULL domain. Best advice is "don't do that" --- not-null domains T

Re: [GENERAL] plpgsql: UPDATE...Returning in FOR loop

2009-03-02 Thread Sam Mason
On Mon, Mar 02, 2009 at 07:34:55PM +, Raymond O'Donnell wrote: > when I try it I get the following error: I've never tried doing things like this before, but it looks as though everything is working. I'd interpret your error message: > gti_messaging=> select recipients_for_delivery(5, 'Email

Re: [GENERAL] plpgsql: UPDATE...Returning in FOR loop

2009-03-02 Thread Tom Lane
"Raymond O'Donnell" writes: > I'm wondering if it's possible to use UPDATE...RETURNING, instead of > SELECT, in a FOR loop like this: > ... > I'm guessing that this isn't possible, because when I try it I get the > following error: > gti_messaging=> select recipients_for_delivery(5, 'Email', 20);

[GENERAL] plpgsql: UPDATE...Returning in FOR loop

2009-03-02 Thread Raymond O'Donnell
Hi all, I'm wondering if it's possible to use UPDATE...RETURNING, instead of SELECT, in a FOR loop like this: for rec in update recipients set batch_id = TheID where recip_id = any ( select recip_id from recipients where msg_id = TheMessage and recip_type = TheType and batch_i