title: How to initialize row datatype variables?
body: <p>I would like to create a function that initialize and return the row datatype of a table as</p>
  
  <pre><code>CREATE FUNCTION get_default_table_row_object() 
  RETURNS mytable AS $$
      DECLARE 
      row mytable;
      BEGIN
          row.field1 := 0;
          row.field2 := -1;
          row.record_reg_id := 1;
          row.record_upd_id := 1;
          row.record_reg_date := current_timestamp;
          row.record_upd_date := current_timestamp;
  
          RETURN row;
      END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>becuase my table has alot of columns and I need to create dozens of variables at several functions. I would like to use above function as</p>
  
  <pre><code>CREATE FUNCTION some_function() RETURNS VOID AS $$
  DECLARE    
      i_obj1 mytable := get_default_table_row_object(); -- declare and initialize default values
  BEGIN
      -- function body
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>But this give me the error <code>ERROR:  default value for row or record variable is not supported</code>. Has someway to figure it out ?</p>