Re: passing linux user to PG server as a variable ?

2020-08-17 Thread Paul Förster
Hi David, > On 17. Aug, 2020, at 21:52, David Gauthier wrote: > > 9.6.7 on linux ok, 12.4 here, but anyway. Try this: $ psql -v osuser=foo psql (12.4) Type "help" for help. postgres=# \echo :osuser foo Cheers, Paul

"Go" (lang) standard driver

2020-08-17 Thread Edson Richter
Is there any standard PostgreSQL driver for Go language? Do members of this group could share experiences with Go + PostgreSQL development? Thanks, E.R.

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread David G. Johnston
On Mon, Aug 17, 2020 at 5:46 PM David Gauthier wrote: > Users will connect to the DB and then update a table using SQL at the > prompt. And I want a post update trigger to identify who (linux user on > the client side) just made that change.I was sort of hoping that this 8 > character

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread David G. Johnston
On Mon, Aug 17, 2020 at 5:46 PM David Gauthier wrote: > >> You lass in the $USER to you client software where it executes a > post-connect hook SQL script populating a temp table with that value, > usually via a function. > > A "post-connect hook SQF script" ? > My (limited) understanding of

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread Ian Barwick
On 2020/08/18 4:52, David Gauthier wrote: Thanks in advance for any replies/ideas ! You could hackily repurpose the "application_name" connection parameter: $ whoami ibarwick $ psql -d "host=localhost dbname=postgres user=postgres application_name=$USER" psql (14devel) Type "help"

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread David Gauthier
>> You lass in the $USER to you client software where it executes a post-connect hook SQL script populating a temp table with that value, usually via a function. A "post-connect hook SQF script" ? My (limited) understanding of this is that once you connect, you're on the server and everything on

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread David G. Johnston
On Monday, August 17, 2020, David Gauthier wrote: > OK, trying to piece together something that might work but I don't see the > pieces falling into place. > From the link you provided... > > "The most fundamental way to set these parameters is to edit the file > postgresql.conf" > So I'm fine

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread David Gauthier
OK, trying to piece together something that might work but I don't see the pieces falling into place. >From the link you provided... "The most fundamental way to set these parameters is to edit the file postgresql.conf" So I'm fine with asking our IT guys to stick some lines in there for us. But

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread David G. Johnston
On Mon, Aug 17, 2020 at 12:53 PM David Gauthier wrote: > Looking at psql command line options, I see "-v" (lowercase) which is > described as... > > -v assignment > --set=assignment > --variable=assignment > > Perform a variable assignment, like the \set meta-command. Note that you > must

Re: passing linux user to PG server as a variable ?

2020-08-17 Thread Tim Clarke
On 17/08/2020 20:52, David Gauthier wrote: 9.6.7 on linux I need to insert the linux username of a user on the client side into a col using an insert statement. I realize that the server knows nothing about who the linux user was on a client, but I was thinking that I might be able to pass

passing linux user to PG server as a variable ?

2020-08-17 Thread David Gauthier
9.6.7 on linux I need to insert the linux username of a user on the client side into a col using an insert statement. I realize that the server knows nothing about who the linux user was on a client, but I was thinking that I might be able to pass that in somehow through a variable. Looking at