</listitem>
</varlistentry>
+ <varlistentry>
+ <term><literal>%p</literal></term>
+ <listitem>
+ <para>The pid of the backend currently connected to.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><literal>%></literal></term>
<listitem><para>The port number at which the database server is listening.</para></listitem>
* %M - database server "hostname.domainname", "[local]" for AF_UNIX
* sockets, "[local:/dir/name]" if not default
* %m - like %M, but hostname only (before first dot), or always "[local]"
+ * %p - backend pid
* %> - database server port number
* %n - database user name
* %/ - current database
if (pset.db)
strlcpy(buf, session_username(), sizeof(buf));
break;
+ /* backend pid */
+ case 'p':
+ if (pset.db)
+ {
+ int pid = PQbackendPID(pset.db);
+ if (pid)
+ snprintf(buf, sizeof(buf), "%d", pid);
+ }
+ break;
case '0':
case '1':