pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Bertheau <twanger@bluetwanger.de>
To: pgsql-sql@postgresql.org
Subject: Is a backend id or something available for use as a foreign key?
Date: Sat, 24 Jul 2004 14:35:07 +0200
Message-ID: <1090672507.6022.7.camel@teetnang> (raw)

Hi,

I have this application which has various users. I want the results of
functions to depend on which user is currently logged on. The usual
reply to this is to use CURRENT_USER. But in my case the application's
users are separate from the database users; the application always uses
the same user to connect to the database. Is there a backend id
available or something similar that would allow me to define a view like
this:

CREATE VIEW my_user_name AS
SELECT
	u.user_name as user_name
FROM
	users u
	JOIN user_has_backend ub ON (u.user_id = ub.user_id)
WHERE
	ub.backend_id = CURRENT_BACKEND_ID;


Thanks

-- 
Markus Bertheau <twanger@bluetwanger.de>




view thread (2+ messages)  latest in thread

Message-ID: <1090672507.6022.7.camel@teetnang>
Permalink:  ../1090672507.6022.7.camel@teetnang/
Also on:    postgresql.org/message-id/1090672507.6022.7.camel@teetnang

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: twanger@bluetwanger.de
  Subject: Re: Is a backend id or something available for use as a foreign key?
  In-Reply-To: <1090672507.6022.7.camel@teetnang>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox