Slony-I 2.2.10 Documentation
Prev | Fast Backward | Chapter 8. Schema schemadoc | Fast Forward | Next

# 8.25. add_missing_table_field(p_type text, p_field text, p_table text, p_namespace text)

Function Properties

Language: PLPGSQL

Return Type: boolean

Add a column of a given type to a table if it is missing

    DECLARE
      v_row       record;
      v_query     text;
    BEGIN
      if not check_table_field_exists(p_namespace, p_table, p_field) then
        raise notice 'Upgrade table %.% - add field %', p_namespace, p_table, p_field;
        v_query := 'alter table ' || p_namespace || '.' || p_table || ' add column ';
        v_query := v_query || p_field || ' ' || p_type || ';';
        execute v_query;
        return 't';
      else
        return 'f';
      end if;
    END;

Prev | Home | Next
add_empty_table_to_replication(p_comment integer, p_idxname integer, p_tabname text, p_nspname text, p_tab_id text, p_set_id text) | Up | addpartiallogindices()