X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 75DA9D1B20E for ; Sat, 24 Jul 2004 09:35:08 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90268-02 for ; Sat, 24 Jul 2004 12:35:10 +0000 (GMT) Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id AF32FD1B1F8 for ; Sat, 24 Jul 2004 09:35:01 -0300 (ADT) Received: from [192.168.0.1] (dsl-082-082-193-009.arcor-ip.net [82.82.193.9]) (authenticated) by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id i6OCZ8I13025 for ; Sat, 24 Jul 2004 14:35:08 +0200 Subject: Is a backend id or something available for use as a foreign key? From: Markus Bertheau To: pgsql-sql@postgresql.org Content-Type: text/plain Message-Id: <1090672507.6022.7.camel@teetnang> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Sat, 24 Jul 2004 14:35:07 +0200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/207 X-Sequence-Number: 18459 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