Re: Multi-row update w. plpgsql function - Mailing list pgsql-sql

From Daniel Hertz
Subject Re: Multi-row update w. plpgsql function
Date
Msg-id 43A0BCD4.7050809@shaw.ca
Whole thread Raw
In response to Re: Multi-row update w. plpgsql function  (Aaron Koning <aaronkoning@gmail.com>)
List pgsql-sql
Aaron Koning wrote:
> Owen makes a good point. Check that you are using the [] in the HTML input
> variable for the checkboxes. Like:
>
> <input type="checkbox" name="approved[]" value="1" /> 1 <br/>
> <input type="checkbox" name="approved[]" value="2" /> 2 <br/>
> <input type="checkbox" name="approved[]" value="3" /> 3 <br/>
> <input type="checkbox" name="approved[]" value="4" /> 4 <br/>
>
> Aaron
>
> On 12/13/05, Owen Jacobson <ojacobson@osl.com> wr
>> I'm not familiar with Cocoon, but I'd expect that to return only the first
>> of the "approved" values from the HTTP request.  If you add logging to the
>> stored function (RAISE NOTICE 'approved: %', approved; near the start of the
>> function, for instance) and tell PostgreSQL to store the logs, you can see
>> what values your function is actually being called with.
>>
>> What you really want to do is begin a transaction, loop over all the
>> values of approved present in the form data and call (the rewritten version
>> of) update_messages for each one, then commit the transaction.
>>
>> -Owen

Thank you all, so much, for taking the time to help me out. Especially 
as a beginner, where coding IS rocket science.

On the general board, Aaron mentioned:

UPDATE message_table SET status = 'A' WHERE mid IN (1,2,3);

which seems very succinct and economical. I'm gonna have a go at parsing the query string using XSLT, substituting the
variablefor:
 

UPDATE message_table SET status = 'A' WHERE mid IN ($query_values_here);

Again, thanks for the help,

Daniel




pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: # of 5 minute intervals in period of time ...
Next
From: Neil Dugan
Date:
Subject: Re: Extract date from week