/usr/share/postgresql/10/contrib/pgq_triggers.sql is in postgresql-10-pgq3 3.2.6-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | -- ----------------------------------------------------------------------
-- Function: pgq.jsontriga()
--
-- Trigger function that puts row data in JSON-encoded form into queue.
--
-- Purpose:
-- Convert row data into easily parseable form.
--
-- Trigger parameters:
-- arg1 - queue name
-- argX - any number of optional arg, in any order
--
-- Optional arguments:
-- SKIP - The actual operation should be skipped (BEFORE trigger)
-- ignore=col1[,col2] - don't look at the specified arguments
-- pkey=col1[,col2] - Set pkey fields for the table, autodetection will be skipped
-- backup - Put urlencoded contents of old row to ev_extra2
-- colname=EXPR - Override field value with SQL expression. Can reference table
-- columns. colname can be: ev_type, ev_data, ev_extra1 .. ev_extra4
-- when=EXPR - If EXPR returns false, don't insert event.
--
-- Queue event fields:
-- ev_type - I/U/D ':' pkey_column_list
-- ev_data - column values urlencoded
-- ev_extra1 - table name
-- ev_extra2 - optional urlencoded backup
--
-- Regular listen trigger example:
-- > CREATE TRIGGER triga_nimi AFTER INSERT OR UPDATE ON customer
-- > FOR EACH ROW EXECUTE PROCEDURE pgq.jsontriga('qname');
--
-- Redirect trigger example:
-- > CREATE TRIGGER triga_nimi BEFORE INSERT OR UPDATE ON customer
-- > FOR EACH ROW EXECUTE PROCEDURE pgq.jsontriga('qname', 'SKIP');
-- ----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION pgq.jsontriga() RETURNS TRIGGER
AS '$libdir/pgq_triggers', 'pgq_jsontriga' LANGUAGE C;
-- ----------------------------------------------------------------------
-- Function: pgq.logutriga()
--
-- Trigger function that puts row data in urlencoded form into queue.
--
-- Purpose:
-- Used as producer for several PgQ standard consumers (cube_dispatcher,
-- queue_mover, table_dispatcher). Basically for cases where the
-- consumer wants to parse the event and look at the actual column values.
--
-- Trigger parameters:
-- arg1 - queue name
-- argX - any number of optional arg, in any order
--
-- Optinal arguments:
-- SKIP - The actual operation should be skipped (BEFORE trigger)
-- ignore=col1[,col2] - don't look at the specified arguments
-- pkey=col1[,col2] - Set pkey fields for the table, autodetection will be skipped
-- backup - Put urlencoded contents of old row to ev_extra2
-- colname=EXPR - Override field value with SQL expression. Can reference table
-- columns. colname can be: ev_type, ev_data, ev_extra1 .. ev_extra4
-- when=EXPR - If EXPR returns false, don't insert event.
--
-- Queue event fields:
-- ev_type - I/U/D ':' pkey_column_list
-- ev_data - column values urlencoded
-- ev_extra1 - table name
-- ev_extra2 - optional urlencoded backup
--
-- Regular listen trigger example:
-- > CREATE TRIGGER triga_nimi AFTER INSERT OR UPDATE ON customer
-- > FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('qname');
--
-- Redirect trigger example:
-- > CREATE TRIGGER triga_nimi BEFORE INSERT OR UPDATE ON customer
-- > FOR EACH ROW EXECUTE PROCEDURE pgq.logutriga('qname', 'SKIP');
-- ----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION pgq.logutriga() RETURNS TRIGGER
AS '$libdir/pgq_triggers', 'pgq_logutriga' LANGUAGE C;
-- ----------------------------------------------------------------------
-- Function: pgq.sqltriga()
--
-- Trigger that generates queue events containing partial SQL.
-- It autodetects table structure.
--
-- Purpose:
-- Replication events, that only need changed column values.
--
-- Parameters:
-- arg1 - queue name
-- argX - any number of optional arg, in any order
--
-- Optinal arguments:
-- SKIP - The actual operation should be skipped (BEFORE trigger)
-- ignore=col1[,col2] - don't look at the specified arguments
-- pkey=col1[,col2] - Set pkey fields for the table, PK autodetection will be skipped
-- backup - Put urlencoded contents of old row to ev_extra2
-- colname=EXPR - Override field value with SQL expression. Can reference table
-- columns. colname can be: ev_type, ev_data, ev_extra1 .. ev_extra4
-- when=EXPR - If EXPR returns false, don't insert event.
--
-- Queue event fields:
-- ev_type - I/U/D
-- ev_data - partial SQL statement
-- ev_extra1 - table name
-- ev_extra2 - optional urlencoded backup
--
-- ----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION pgq.sqltriga() RETURNS trigger
AS '$libdir/pgq_triggers', 'pgq_sqltriga' LANGUAGE C;
|