tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ft_set_default_values()
Parameters
Name
Type
Mode
IN
Definition
DECLARE sch text; tbl text; col text; ttp text; BEGIN FOR sch,tbl,col,ttp IN SELECT t.table_schema, c.table_name, c.column_name, CASE WHEN t.table_type = 'BASE TABLE' then 'TABLE' ELSE t.table_type END FROM information_schema.columns c LEFT JOIN information_schema.tables t ON c.table_name = t.table_name and c.table_schema = t.table_schema WHERE c.column_name = NEW.fieldname and ((c.table_schema ='tww_od' and t.table_type = 'BASE TABLE') OR (c.table_schema ='tww_app' and t.table_type = 'VIEW')) LOOP EXECUTE format($$ ALTER %4$s %1$I.%2$I ALTER COLUMN %3$I SET DEFAULT tww_app.get_default_values('%2$s') $$, sch,tbl,col,ttp); END LOOP; RETURN NEW; END;