On 06/13/2011 07:04 AM, Sim Zacks wrote:
I didn't see a function for this, but is there a way in a postgresql query to determine the client OS?
A PostgreSQL client application is something that speaks a correct protocol to the server. The server has no concept of what the client is other than the fact that it speaks a particular version of its language. It knows the IP address and port number it connected on, but that's basically it. So the idea of a query determining the client OS doesn't make sense; all it knows is what the client tells it, and the information required to connect to the server and execute queries does not include any such details.
If you want information about a client to make its way into a statement run on the server, you have to drive that from the direction of the client you're using yourself. If your client is psql for example, you might pass client-side information into the program by using the -v/--set/--variable substitution mechanism, possibly combined with the SQL interpolation facility of psql. But if your client program is in another programming language, you'll have to use some facility in it to fill in this information.
-- Greg Smith 2ndQuadrant US greg@xxxxxxxxxxxxxxx Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general