Re: determine client os - Mailing list pgsql-general

From Greg Smith
Subject Re: determine client os
Date
Msg-id 4DF6F29A.8030301@2ndQuadrant.com
Whole thread Raw
In response to determine client os  (Sim Zacks <sim@compulab.co.il>)
List pgsql-general
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@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books


pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: PGP encrypt/decrypt - Prereqistes
Next
From: AI Rumman
Date:
Subject: system command in dblink?