terraware
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
enablelongtransactions
Description
Enables long transaction support.
Parameters
Name
Type
Mode
Definition
DECLARE "query" text; exists bool; rec RECORD; BEGIN exists = 'f'; FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorization_table' LOOP exists = 't'; END LOOP; IF NOT exists THEN "query" = 'CREATE TABLE authorization_table ( toid oid, -- table oid rid text, -- row id expires timestamp, authid text )'; EXECUTE "query"; END IF; exists = 'f'; FOR rec IN SELECT * FROM pg_class WHERE relname = 'authorized_tables' LOOP exists = 't'; END LOOP; IF NOT exists THEN "query" = 'CREATE VIEW authorized_tables AS ' || 'SELECT ' || 'n.nspname as schema, ' || 'c.relname as table, trim(' || quote_literal(chr(92) || '000') || ' from t.tgargs) as id_column ' || 'FROM pg_trigger t, pg_class c, pg_proc p ' || ', pg_namespace n ' || 'WHERE p.proname = ' || quote_literal('checkauthtrigger') || ' AND c.relnamespace = n.oid' || ' AND t.tgfoid = p.oid and t.tgrelid = c.oid'; EXECUTE "query"; END IF; RETURN 'Long transactions support enabled'; END;