Re: determine client os

From: Greg Smith <greg(at)2ndQuadrant(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: determine client os
Date: 2011-06-14 05:33:14
Message-ID: 4DF6F29A.8030301@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books

In response to

Browse pgsql-general by date

  From Date Subject
Next Message AI Rumman 2011-06-14 06:17:22 system command in dblink?
Previous Message Craig Ringer 2011-06-14 05:30:10 Re: PGP encrypt/decrypt - Prereqistes