diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml index b783e86..9ec7a6e 100644 --- a/doc/src/sgml/plperl.sgml +++ b/doc/src/sgml/plperl.sgml @@ -634,7 +634,7 @@ SELECT init_hosts_query(); SELECT query_hosts('192.168.1.0/30'); SELECT release_hosts_query(); - query_hosts + query_hosts ----------------- (1,192.168.1.1) (2,192.168.1.2) diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index 07f017a..e2a8f41 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -441,7 +441,7 @@ return (1, 2, 3, 4, 5) $$ LANGUAGE plpythonu; SELECT return_arr(); - return_arr + return_arr ------------- {1,2,3,4,5} (1 row) diff --git a/doc/src/sgml/ref/alter_event_trigger.sgml b/doc/src/sgml/ref/alter_event_trigger.sgml index e236921..d4af986 100644 --- a/doc/src/sgml/ref/alter_event_trigger.sgml +++ b/doc/src/sgml/ref/alter_event_trigger.sgml @@ -12,7 +12,7 @@ PostgreSQL documentation ALTER EVENT TRIGGER - change the definition of a trigger + change the definition of an event trigger @@ -46,7 +46,7 @@ ALTER EVENT TRIGGER name RENAME TO - You must be superuser to alter a event trigger. + You must be superuser to alter an event trigger. diff --git a/doc/src/sgml/ref/create_event_trigger.sgml b/doc/src/sgml/ref/create_event_trigger.sgml index af06c88..fdf7a6d 100644 --- a/doc/src/sgml/ref/create_event_trigger.sgml +++ b/doc/src/sgml/ref/create_event_trigger.sgml @@ -12,7 +12,7 @@ PostgreSQL documentation CREATE EVENT TRIGGER - define a new trigger + define a new event trigger @@ -128,13 +128,13 @@ CREATE EVENT TRIGGER name The trigger will be associated with the specified event and will execute the specified function function_name when - that event is run. + that event occurs. - The command trigger gives a procedure to fire before the event is + The event trigger gives a procedure to fire before the event is executed. In some cases the procedure can be fired instead of the event - code PostgreSQL would run itself. A command trigger's function must + code PostgreSQL would run itself. A event trigger's function must return event_trigger data type. It can then only abort the execution of the command by raising an exception. @@ -186,7 +186,7 @@ CREATE EVENT TRIGGER name The command ALTER TYPE ... ADD VALUE ... prevents - transaction control entirely, thus no command trigger will get fired + transaction control entirely, thus no event trigger will get fired when it's used. diff --git a/doc/src/sgml/ref/drop_event_trigger.sgml b/doc/src/sgml/ref/drop_event_trigger.sgml index fc45dff..6b30dd9 100644 --- a/doc/src/sgml/ref/drop_event_trigger.sgml +++ b/doc/src/sgml/ref/drop_event_trigger.sgml @@ -12,7 +12,7 @@ PostgreSQL documentation DROP EVENT TRIGGER - remove a event trigger + remove an event trigger diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index 4ea2848..561ce42 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -49,7 +49,7 @@ static void AlterEventTriggerOwner_internal(Relation rel, Oid newOwnerId); /* - * Check permission: command triggers are only available for superusers. Raise + * Check permission: event triggers are only available for superusers. Raise * an exception when requirements are not fullfilled. * * It's not clear how to accept that database owners be able to create command @@ -62,7 +62,7 @@ CheckEventTriggerPrivileges() if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("must be superuser to use command triggers")))); + (errmsg("must be superuser to use event triggers")))); } /* @@ -214,7 +214,7 @@ RemoveEventTriggerById(Oid trigOid) } /* - * ALTER EVENT TRIGGER foo ON COMMAND ... ENABLE|DISABLE|ENABLE ALWAYS|REPLICA + * ALTER EVENT TRIGGER foo ENABLE|DISABLE|ENABLE ALWAYS|REPLICA */ void AlterEventTrigger(AlterEventTrigStmt *stmt) @@ -248,7 +248,7 @@ AlterEventTrigger(AlterEventTrigStmt *stmt) /* - * Rename command trigger + * Rename event trigger */ void RenameEventTrigger(const char *trigname, const char *newname) @@ -382,9 +382,9 @@ get_event_trigger_oid(const char *trigname, bool missing_ok) } /* - * Functions to execute the command triggers. + * Functions to execute the event triggers. * - * We call the functions that matches the command triggers definitions in + * We call the functions that matches the event triggers definitions in * alphabetical order, and give them those arguments: * * toplevel command tag, text @@ -394,7 +394,7 @@ get_event_trigger_oid(const char *trigname, bool missing_ok) * objectname, text * * Those are passed down as special "context" magic variables and need specific - * support in each PL that wants to support command triggers. All core PL do. + * support in each PL that wants to support event triggers. All core PL do. */ static void @@ -409,7 +409,7 @@ call_event_trigger_procedure(EventContext ev_ctx, TrigEvent tev, fmgr_info(proc, &flinfo); /* - * Prepare the command trigger function context from the Command Context. + * Prepare the event trigger function context from the Command Context. * We prepare a dedicated Node here so as not to publish internal data. */ trigdata.type = T_EventTriggerData; @@ -440,11 +440,11 @@ call_event_trigger_procedure(EventContext ev_ctx, TrigEvent tev, void InitEventContext(EventContext evt, const Node *parsetree) { - evt->command = E_UNKNOWN; - evt->toplevel = NULL; - evt->tag = (char *) CreateCommandTag((Node *)parsetree); - evt->parsetree = (Node *)parsetree; - evt->objectId = InvalidOid; + evt->command = E_UNKNOWN; + evt->toplevel = NULL; + evt->tag = (char *) CreateCommandTag((Node *)parsetree); + evt->parsetree = (Node *)parsetree; + evt->objectId = InvalidOid; evt->objectname = NULL; evt->schemaname = NULL; @@ -1010,8 +1010,9 @@ InitEventContext(EventContext evt, const Node *parsetree) break; default: - /* reaching that part of the code only means that we are not - * supporting command triggers for the given command, which still + /* + * reaching that part of the code only means that we are not + * supporting event triggers for the given command, which still * needs to execute. */ break; @@ -1037,7 +1038,7 @@ CommandFiresTriggersForEvent(EventContext ev_ctx, TrigEvent tev) } /* - * Actually run command triggers of a specific command. We first run ANY + * Actually run event triggers for a specific command. We first run ANY * command triggers. */ void diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 29eec11..c8c1a81 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -63,6 +63,7 @@ #include "utils/lsyscache.h" #include "utils/syscache.h" + /* Hook for plugins to get control in ProcessUtility() */ ProcessUtility_hook_type ProcessUtility_hook = NULL; @@ -356,11 +357,8 @@ standard_ProcessUtility(Node *parsetree, /* Event Trigger support for command_start */ InitEventContext(&evt, (Node *)parsetree); - if (CommandFiresTriggersForEvent(&evt, E_CommandStart)) - { ExecEventTriggers(&evt, E_CommandStart); - } switch (nodeTag(parsetree)) { diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 17b62b6..ec93149 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -39,11 +39,9 @@ #include "nodes/nodeFuncs.h" #include "optimizer/clauses.h" #include "optimizer/tlist.h" -#include "parser/analyze.h" #include "parser/keywords.h" #include "parser/parse_func.h" #include "parser/parse_oper.h" -#include "parser/parse_type.h" #include "parser/parser.h" #include "parser/parsetree.h" #include "rewrite/rewriteHandler.h" @@ -261,6 +259,7 @@ static char *flatten_reloptions(Oid relid); #define only_marker(rte) ((rte)->inh ? "" : "ONLY ") + /* ---------- * get_ruledef - Do it all and return a text * that could be used as a statement diff --git a/src/backend/utils/cache/evtcache.c b/src/backend/utils/cache/evtcache.c index 65bc6be..cf9f3e5 100644 --- a/src/backend/utils/cache/evtcache.c +++ b/src/backend/utils/cache/evtcache.c @@ -116,7 +116,7 @@ add_funcall_to_command_event(TrigEvent event, * foreach(cell, EventCommandTriggerCache[TrigEventCommand][TrigEvent]) */ static void -BuildEventTriggerCache() +BuildEventTriggerCache(void) { HASHCTL info; Relation rel, irel; @@ -144,8 +144,9 @@ BuildEventTriggerCache() indexScan = index_beginscan(rel, irel, SnapshotNow, 0, 0); index_rescan(indexScan, NULL, 0, NULL, 0); - /* we use a full indexscan to guarantee that we see event triggers ordered - * by name, this way we only even have to append the trigger's function Oid + /* + * We use a full indexscan to guarantee that we see event triggers ordered + * by name. This way, we only even have to append the trigger's function Oid * to the target cache Oid list. */ while (HeapTupleIsValid(tuple = index_getnext(indexScan, ForwardScanDirection))) @@ -327,7 +328,8 @@ get_event_triggers(TrigEvent event, TrigEventCommand command) lc_any_procs = lnext(lc_any_procs); } - /* now append as many elements from CMD list named before next ANY + /* + * now append as many elements from CMD list named before next ANY * entry */ do diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 993053c..09e104f 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -242,7 +242,7 @@ getSchemaData(Archive *fout, int *numTablesPtr) getTriggers(fout, tblinfo, numTables); if (g_verbose) - write_msg(NULL, "reading command triggers\n"); + write_msg(NULL, "reading event triggers\n"); getEvtTriggers(fout, &numEvtTriggers); *numTablesPtr = numTables; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 75b7ff0..ef859dc 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -5300,7 +5300,7 @@ getTriggers(Archive *fout, TableInfo tblinfo[], int numTables) /* * getEvtTriggers - * get information about every command trigger on a dumpable table + * get information about event triggers */ EvtTriggerInfo * getEvtTriggers(Archive *fout, int *numEvtTriggers) diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 5807265..0843b65 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -229,7 +229,7 @@ slashUsage(unsigned short int pager) fprintf(output, _(" \\dv[S+] [PATTERN] list views\n")); fprintf(output, _(" \\dE[S+] [PATTERN] list foreign tables\n")); fprintf(output, _(" \\dx[+] [PATTERN] list extensions\n")); - fprintf(output, _(" \\dy [PATTERN] list command triggers\n")); + fprintf(output, _(" \\dy [PATTERN] list event triggers\n")); fprintf(output, _(" \\l[+] list all databases\n")); fprintf(output, _(" \\sf[+] FUNCNAME show a function's definition\n")); fprintf(output, _(" \\z [PATTERN] same as \\dp\n")); diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 340de88..bee7154 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -4645,6 +4645,7 @@ DESCR("SP-GiST support for suffix tree over text"); DATA(insert OID = 4031 ( spg_text_leaf_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 16 "2281 2281" _null_ _null_ _null_ _null_ spg_text_leaf_consistent _null_ _null_ _null_ )); DESCR("SP-GiST support for suffix tree over text"); + /* * Symbolic values for provolatile column: these indicate whether the result * of a function is dependent *only* on the values of its explicit arguments, diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 71563ad..1063403 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -1013,7 +1013,6 @@ extern Datum pg_encoding_max_length_sql(PG_FUNCTION_ARGS); /* format_type.c */ extern Datum format_type(PG_FUNCTION_ARGS); extern char *format_type_be(Oid type_oid); -extern char *format_type_be_without_namespace(Oid type_oid); extern char *format_type_with_typemod(Oid type_oid, int32 typemod); extern Datum oidvectortypes(PG_FUNCTION_ARGS); extern int32 type_maximum_size(Oid type_oid, int32 typemod); diff --git a/src/pl/plperl/expected/plperl_trigger.out b/src/pl/plperl/expected/plperl_trigger.out index b61d47c..bfb59db 100644 --- a/src/pl/plperl/expected/plperl_trigger.out +++ b/src/pl/plperl/expected/plperl_trigger.out @@ -309,7 +309,7 @@ $$ LANGUAGE plperl; SELECT direct_trigger(); ERROR: trigger functions can only be called as triggers CONTEXT: compilation of PL/Perl function "direct_trigger" --- test plperl command triggers +-- test plperl event triggers create or replace function perlsnitch() returns event_trigger language plperl as $$ elog(NOTICE, "perlsnitch: " . $_TD->{when} . " " diff --git a/src/pl/plperl/sql/plperl_trigger.sql b/src/pl/plperl/sql/plperl_trigger.sql index 9cc2408..1c0d37b 100644 --- a/src/pl/plperl/sql/plperl_trigger.sql +++ b/src/pl/plperl/sql/plperl_trigger.sql @@ -170,7 +170,7 @@ $$ LANGUAGE plperl; SELECT direct_trigger(); --- test plperl command triggers +-- test plperl event triggers create or replace function perlsnitch() returns event_trigger language plperl as $$ elog(NOTICE, "perlsnitch: " . $_TD->{when} . " " diff --git a/src/pl/plpython/expected/plpython_trigger.out b/src/pl/plpython/expected/plpython_trigger.out index f756462..197431b 100644 --- a/src/pl/plpython/expected/plpython_trigger.out +++ b/src/pl/plpython/expected/plpython_trigger.out @@ -610,7 +610,7 @@ SELECT * FROM composite_trigger_nested_test; ("(,t)","(1,f)",) (3 rows) --- test plpython command triggers +-- test plpython event triggers create or replace function pysnitch() returns event_trigger language plpythonu as $$ plpy.notice(" pysnitch: %s %s %s.%s" % (TD["when"], TD["tag"], TD["schemaname"], TD["objectname"])); diff --git a/src/pl/plpython/sql/plpython_trigger.sql b/src/pl/plpython/sql/plpython_trigger.sql index 7ec6e0b..4df599a 100644 --- a/src/pl/plpython/sql/plpython_trigger.sql +++ b/src/pl/plpython/sql/plpython_trigger.sql @@ -388,7 +388,7 @@ INSERT INTO composite_trigger_nested_test VALUES (ROW(ROW(1, 'f'), NULL, 3)); INSERT INTO composite_trigger_nested_test VALUES (ROW(ROW(NULL, 't'), ROW(1, 'f'), NULL)); SELECT * FROM composite_trigger_nested_test; --- test plpython command triggers +-- test plpython event triggers create or replace function pysnitch() returns event_trigger language plpythonu as $$ plpy.notice(" pysnitch: %s %s %s.%s" % (TD["when"], TD["tag"], TD["schemaname"], TD["objectname"])); diff --git a/src/pl/tcl/expected/pltcl_setup.out b/src/pl/tcl/expected/pltcl_setup.out index 9b9c157..f4dcbe7 100644 --- a/src/pl/tcl/expected/pltcl_setup.out +++ b/src/pl/tcl/expected/pltcl_setup.out @@ -519,7 +519,7 @@ select tcl_date_week(2001,10,24); 42 (1 row) --- test pltcl command triggers +-- test pltcl event triggers create or replace function tclsnitch() returns event_trigger language pltcl as $$ elog NOTICE " tclsnitch: $TG_when $TG_tag $TG_schemaname $TG_objectname" $$; diff --git a/src/pl/tcl/sql/pltcl_setup.sql b/src/pl/tcl/sql/pltcl_setup.sql index 864e23b..c8436f0 100644 --- a/src/pl/tcl/sql/pltcl_setup.sql +++ b/src/pl/tcl/sql/pltcl_setup.sql @@ -560,7 +560,7 @@ $$ language pltcl immutable; select tcl_date_week(2010,1,24); select tcl_date_week(2001,10,24); --- test pltcl command triggers +-- test pltcl event triggers create or replace function tclsnitch() returns event_trigger language pltcl as $$ elog NOTICE " tclsnitch: $TG_when $TG_tag $TG_schemaname $TG_objectname" $$;