Warning: is_dir(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/data/web/virtuals/98151/virtual) in /data/web/virtuals/98151/virtual/www/subdom/postgresql/wp-content/plugins/wp-simple-firewall/src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Fs.php on line 465

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/98151/virtual/www/subdom/postgresql/wp-content/plugins/wp-simple-firewall/src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Fs.php:465) in /data/web/virtuals/98151/virtual/www/subdom/postgresql/wp-content/plugins/disable-xml-rpc-pingback/disable-xml-rpc-pingback.php on line 51
Triggers / Event triggers Archives - PostgreSQL Candies

Event triggers in PostgreSQL 11

Based on documentation and several different examples on web I created this code for event triggers for PG 11. Maybe it can be useful for someone else too: — auditing table — CREATE TABLE IF NOT EXISTS public.ddl_history (ddl_date TIMESTAMP, ddl_tag TEXT,...

Show source code of trigger function

Because I found with surprise that DataGrip shows irregular version of trigger function’s source code and pgAdmin 4 somehow refuses to show it at all (claiming internal server error) I had to find some other way how to access it. Solution is described here...

Triggers – some useful queries

show parent tables with trigger names: select inhparent, inhparent::regclass, count(*) as _count, (select string_agg(tgname,',') from pg_trigger t where t.tgrelid=i.inhparent ) as triggers from pg_inherits i group by 1 order by 1; show tables with user created...

Event triggers in PostgreSQL 9.3 / 9.4

Well in versions 9.3 and 9.4 event triggers are something like “very good start”. You can use them quite well but it is not exactly 100% comfortable. How to use them: Create function which returns “event_trigger”. Function will end with just...