Q:

Update table being returned in PostgreSQL

I'm looking for help with a PostgreSQL function that returns a table.
I would like to know if there is a way of updating the table that is being returned.
Here's an example,
create or replace function fn_function()
return table(column01 integer, column02 integer, column03 boolean) as $$
    return query
    select col1, col2, false
    from tableXYZ;

    /* how can i update the table, let's say column03 before the function exits */

end
$$ language plpgsql;

Can i give an alias to the table being returned? 
The postgre version in use is 9.0.8.
Thx in advance.

A:

Here is a set based solution.
The RETURNS TABLE is just portal to get data out you can't do anything inside the function that defines it. You could create another function and call this one and do things to the result set. However I use a temp table so you can manipulate the data before you send it out. 
CREATE OR REPLACE FUNCTION fn_function()
    RETURNS TABLE(column01 integer, column02 integer, column03 boolean) AS $$
    BEGIN

      CREATE TEMP TABLE temp_tableXYZ (column01 integer, column02 integer, column03 boolean) ON COMMIT DROP;

     INSERT INTO temp_tableXYZ (column01, column02, column03)
     SELECT col1,col2,col3
     FROM tableXYZ;
     --WHERE filter if you can.

      UPDATE temp_tableXYZ
      SET col1 = 9999;

      RETURN QUERY select column01, column02, column03 from temp_tableXYZ;
    END;
    $$ LANGUAGE plpgsql;

You can call it using an alias like this:
SELECT * FROM fn_function() as my_table;

