gis
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
add_uid_columns
Parameters
Name
Type
Mode
p_schema_name
text
IN
p_table_name
text
IN
Definition
DECLARE query text; BEGIN BEGIN SELECT INTO query concat( ' ALTER TABLE ' || quote_ident(p_schema_name) || '.' || quote_ident(p_table_name) || ' ADD COLUMN uid uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid ' || ' UNIQUE NOT NULL' ); execute query; RAISE NOTICE 'uid column created for % %', quote_ident(p_schema_name), quote_ident(p_table_name); RETURN True; EXCEPTION WHEN OTHERS THEN RAISE NOTICE 'ERROR - uid column already exists'; RETURN False; END; END;