Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4665ceb

Browse filesBrowse files
Login event trigger documentation wordsmithing
Minor wordsmithing on the login trigger documentation and code comments to improve readability, as well as fixing a few small incorrect statements in the comments. Author: Robert Treat <rob@xzilla.net> Discussion: https://postgr.es/m/CAJSLCQ0aMWUh1m6E9YdjeqV61baQ=EhteJX8XOxXg8H_2Lcr0Q@mail.gmail.com
1 parent b4a71cf commit 4665ceb
Copy full SHA for 4665ceb

File tree

Expand file treeCollapse file tree

2 files changed

+14
-14
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-14
lines changed

‎doc/src/sgml/event-trigger.sgml

Copy file name to clipboardExpand all lines: doc/src/sgml/event-trigger.sgml
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@
3939
<para>
4040
The <literal>login</literal> event occurs when an authenticated user logs
4141
into the system. Any bug in a trigger procedure for this event may
42-
prevent successful login to the system. Such bugs may be fixed by
43-
setting <xref linkend="guc-event-triggers"/> is set to <literal>false</literal>
44-
either in a connection string or configuration file. Alternative is
45-
restarting the system in single-user mode (as event triggers are
42+
prevent successful login to the system. Such bugs may be worked around by
43+
setting <xref linkend="guc-event-triggers"/> to <literal>false</literal>
44+
either in a connection string or configuration file. Alternatively, you can
45+
restart the system in single-user mode (as event triggers are
4646
disabled in this mode). See the <xref linkend="app-postgres"/> reference
4747
page for details about using single-user mode.
4848
The <literal>login</literal> event will also fire on standby servers.
4949
To prevent servers from becoming inaccessible, such triggers must avoid
5050
writing anything to the database when running on a standby.
5151
Also, it's recommended to avoid long-running queries in
5252
<literal>login</literal> event triggers. Note that, for instance,
53-
canceling connection in <application>psql</application> wouldn't cancel
53+
canceling a connection in <application>psql</application> will not cancel
5454
the in-progress <literal>login</literal> trigger.
5555
</para>
5656

‎src/backend/commands/event_trigger.c

Copy file name to clipboardExpand all lines: src/backend/commands/event_trigger.c
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ CreateEventTrigger(CreateEventTrigStmt *stmt)
174174
else if (strcmp(stmt->eventname, "login") == 0 && tags != NULL)
175175
ereport(ERROR,
176176
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
177-
errmsg("tag filtering is not supported for login event trigger")));
177+
errmsg("tag filtering is not supported for login event triggers")));
178178

179179
/*
180180
* Give user a nice error message if an event trigger of the same name
@@ -307,7 +307,7 @@ insert_event_trigger_tuple(const char *trigname, const char *eventname, Oid evtO
307307
heap_freetuple(tuple);
308308

309309
/*
310-
* Login event triggers have an additional flag in pg_database to avoid
310+
* Login event triggers have an additional flag in pg_database to enable
311311
* faster lookups in hot codepaths. Set the flag unless already True.
312312
*/
313313
if (strcmp(eventname, "login") == 0)
@@ -376,7 +376,7 @@ filter_list_to_array(List *filterlist)
376376

377377
/*
378378
* Set pg_database.dathasloginevt flag for current database indicating that
379-
* current database has on login triggers.
379+
* current database has on login event triggers.
380380
*/
381381
void
382382
SetDatatabaseHasLoginEventTriggers(void)
@@ -444,7 +444,7 @@ AlterEventTrigger(AlterEventTrigStmt *stmt)
444444
CatalogTupleUpdate(tgrel, &tup->t_self, tup);
445445

446446
/*
447-
* Login event triggers have an additional flag in pg_database to avoid
447+
* Login event triggers have an additional flag in pg_database to enable
448448
* faster lookups in hot codepaths. Set the flag unless already True.
449449
*/
450450
if (namestrcmp(&evtForm->evtevent, "login") == 0 &&
@@ -695,7 +695,7 @@ EventTriggerCommonSetup(Node *parsetree,
695695
}
696696
}
697697

698-
/* don't spend any more time on this if no functions to run */
698+
/* Don't spend any more time on this if no functions to run */
699699
if (runlist == NIL)
700700
return NIL;
701701

@@ -878,7 +878,7 @@ EventTriggerSQLDrop(Node *parsetree)
878878

879879
/*
880880
* Fire login event triggers if any are present. The dathasloginevt
881-
* pg_database flag is left when an event trigger is dropped, to avoid
881+
* pg_database flag is left unchanged when an event trigger is dropped to avoid
882882
* complicating the codepath in the case of multiple event triggers. This
883883
* function will instead unset the flag if no trigger is defined.
884884
*/
@@ -891,7 +891,7 @@ EventTriggerOnLogin(void)
891891
/*
892892
* See EventTriggerDDLCommandStart for a discussion about why event
893893
* triggers are disabled in single user mode or via a GUC. We also need a
894-
* database connection (some background workers doesn't have it).
894+
* database connection (some background workers don't have it).
895895
*/
896896
if (!IsUnderPostmaster || !event_triggers ||
897897
!OidIsValid(MyDatabaseId) || !MyDatabaseHasLoginEventTriggers)
@@ -920,7 +920,7 @@ EventTriggerOnLogin(void)
920920

921921
/*
922922
* There is no active login event trigger, but our
923-
* pg_database.dathasloginevt was set. Try to unset this flag. We use the
923+
* pg_database.dathasloginevt is set. Try to unset this flag. We use the
924924
* lock to prevent concurrent SetDatatabaseHasLoginEventTriggers(), but we
925925
* don't want to hang the connection waiting on the lock. Thus, we are
926926
* just trying to acquire the lock conditionally.
@@ -931,7 +931,7 @@ EventTriggerOnLogin(void)
931931
/*
932932
* The lock is held. Now we need to recheck that login event triggers
933933
* list is still empty. Once the list is empty, we know that even if
934-
* there is a backend, which concurrently inserts/enables login
934+
* there is a backend which concurrently inserts/enables a login event
935935
* trigger, it will update pg_database.dathasloginevt *afterwards*.
936936
*/
937937
runlist = EventTriggerCommonSetup(NULL,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.