Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Ross Bagley
On 10/2/07, Alvaro Herrera <[EMAIL PROTECTED]> wrote: > Right. Use GET DIAGNOSTICS foo = ROW_COUNT Works great! Thank you. Ross -- Ross Bagley "Security is mostly a superstition. It does not exist in nature... Life is either a daring adventure or nothing." -- Helen Keller -

Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Ross Bagley
In this simplified case, given an open SQL connection, you're correct. That would simplify this query, and I'm a little embarrassed not to have seen that (obexcuse: I've been spending too much time in Java-land lately). There is more to the function than I included in my question, so it does need

Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Joshua D. Drake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ross Bagley wrote: > Newbie to pl/pgsql here. > > I'm trying to create a function that cleans up the foreign keys > referring to a particular row (if any exist), then removes the row (if > it exists), and returns the number of rows of br_role that wer

Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Alvaro Herrera
Ross Bagley wrote: > I did come across FOUND, which leads to this: > > CREATE OR REPLACE FUNCTION delete_role(del_role_pk bigint) RETURNS int AS $$ > BEGIN > DELETE FROM br_actor_role_mm WHERE role_fk = del_role_pk; > DELETE FROM br_role_permission_mm WHERE role_fk = del_role_pk; > DE

[GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Ross Bagley
Newbie to pl/pgsql here. I'm trying to create a function that cleans up the foreign keys referring to a particular row (if any exist), then removes the row (if it exists), and returns the number of rows of br_role that were deleted (0 or 1). Newbie stored procedure: CREATE OR REPLACE FUNCTION de