SCM

[#1000711] Add PID property to NpgsqlConnection

View Trackers | Feature Requests | Download .csv | Monitor

Date:
2006-08-16 04:56
Priority:
3
State:
Open
Submitted by:
David Boone (boone)
Assigned to:
Nobody (None)
Category:
Interface Improvements (example)
Group:
Next Release (example)
Resolution:
None
 
Summary:
Add PID property to NpgsqlConnection

Detailed description
Currently there is no easy way to get the PID of the connection. This becomes necessary when dealing with notifications, when we want to filter out notifications sent by ourselves.

For example if we have a notification sent out by a trigger indicating that a table has changed, we probably want to filter out those caused by our own updates to the database.

Currently the only way to figure out this value (that I can see) is to LISTEN to and send out your own notification and grab the PID from that event.

Example:

new NpgsqlCommand("LISTEN randomstring", pg_connection).ExecuteNonQuery();
new NpgsqlCommand("NOTIFY randomstring", pg_connection).ExecuteNonQuery();

Then in your Notification event:

if (e.Condition == "randomstring")
int ourOwnPID = e.PID;

Followup

Message
Date: 2006-09-14 01:19
Sender: Josh Cooley

You can also get the PID for the connection by executing
"select pg_backend_pid()".

The feature seems easy enough to implement. I'll look in to implementing this after 1.0 is released.

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge