Fetching Server configured port from C Module - Mailing list pgsql-general

From Mike Roest
Subject Fetching Server configured port from C Module
Date
Msg-id CAE7Byhhbn=91Y1OXxFs08CQ5TTnAFhhfrK+yLkfv2PfEKQGjbQ@mail.gmail.com
Whole thread Raw
Responses Re: Fetching Server configured port from C Module
Re: Fetching Server configured port from C Module
List pgsql-general
Hi There,
   I'm having a bit of an issue finding a C function to fetch the configured server port from a C module.

We have written a C module to allow for remote clients to call a function to run pg_dump/pg_restore remotely but create files locally on the db server.  

Currently it works fine if the client connects through a network socket as we're using inet_server_port to get the port to pass onto pg_dump/restore.  But if the client is connected through a unix socket (actually a remote client connecting to pgbouncer which is connecting to postgres though the unix socket) inet_server_port is null.  I've looked for a function that we can use to get the configured server port but haven't had any luck.  

I could hard code the port in the module when we build it but it would be nice to be able to change the configured postgres port and not have to rebuild the module.

Anyone have any suggestions?

I've posted the code for our backup module here:


pgsql-general by date:

Previous
From: Dale Fukami
Date:
Subject: Re: Mysterious table that exists but doesn't exist
Next
From: Bruce Momjian
Date:
Subject: Re: Fetching Server configured port from C Module