diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index a12ee56ad02af2772d7e34c094437774a0cee19f..0069573c45905f167ae52bf2b4a8a4ba10b9ada1 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -7871,16 +7871,27 @@
 
   <para>
    The <structfield>pid</structfield> column can be joined to the
-   <structfield>pid</structfield> column of the
-   <structname>pg_stat_activity</structname> view to get more
-   information on the session holding or waiting to hold each lock.
+   <structfield>pid</structfield> column of the <link
+   linkend="pg-stat-activity-view"><structname>pg_stat_activity</structname></link>
+   view to get more
+   information on the session holding or waiting to hold each lock,
+   for example
+<programlisting>
+SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa
+    ON pl.pid = psa.pid;
+</programlisting>
    Also, if you are using prepared transactions, the
-   <structfield>transaction</> column can be joined to the
-   <structfield>transaction</structfield> column of the
-   <structname>pg_prepared_xacts</structname> view to get more
-   information on prepared transactions that hold locks.
+   <structfield>virtualtransaction</> column can be joined to the
+   <structfield>transaction</structfield> column of the <link
+   linkend="view-pg-prepared-xacts"><structname>pg_prepared_xacts</structname></link>
+   view to get more information on prepared transactions that hold locks.
    (A prepared transaction can never be waiting for a lock,
    but it continues to hold the locks it acquired while running.)
+   For example:
+<programlisting>
+SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
+    ON pl.virtualtransaction = '-1/' || ppx.transaction;
+</programlisting>
   </para>
 
   <para>