Getting process id of a connection?

Поиск
Список
Период
Сортировка
От Webb Sprague
Тема Getting process id of a connection?
Дата
Msg-id b11ea23c0801041459l508700adw768e38b13c8de184@mail.gmail.com
обсуждение исходный текст
Ответы Re: Getting process id of a connection?  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: Getting process id of a connection?  (Bricklen Anderson <banderson@presinet.com>)
Список pgsql-general
Hi all,

Is there a way to determine the pid of a database connection from
within that connection?

As a hypothetical example, I would like to be able to do the following:

$ps x
  PID TTY      STAT   TIME COMMAND
11674 ?        S      0:00 sshd: webbs@pts/1
11675 pts/1    Ss     0:00 -bash
11682 pts/1    T      0:00 psql
11685 pts/1    R+     0:00 ps x

psql=# select CURRENT_PID;
11682

I want this so that I can log the psycopg2 connection pid, and kill it
to test reconnection code.

Thanks!
-W

В списке pgsql-general по дате отправления:

Предыдущее
От: "beer@cmu.edu"
Дата:
Сообщение: Re: data volume resizing and large objects
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Getting process id of a connection?