"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Peter Eisentraut <peter_e@gmx.net> wrote:
>> Why not just compare pg_backend_pid() with postmaster.pid?
> See the prior discussion in the archives. We started with that and
> found problems, to which Tom suggested a random number as the best
> solution.
I think Peter's idea is a bit different though. The previous concern
was about what information would be okay to expose in a pg_ping response
packet, which presumably would be available to anybody who could open a
connection to the postmaster port. What he's suggesting is to
crosscheck against data that is available after a successful login.
That eliminates the security complaint.
It strikes me we could do something without adding a postmaster-PID
SQL function, too. What about doing SHOW DATA_DIRECTORY and comparing
that to what pg_regress expects?
regards, tom lane