X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id C1BA29FA4F0 for ; Sun, 10 Sep 2006 22:20:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 27608-03 for ; Mon, 11 Sep 2006 01:20:04 +0000 (UTC) X-Greylist: delayed 00:22:26.821391 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 475DC9FB213 for ; Sun, 10 Sep 2006 22:20:03 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from anumail8.anu.edu.au (anumail8.anu.edu.au [130.56.64.134]) by svr4.postgresql.org (Postfix) with ESMTP id 9CC465AFA79 for ; Mon, 11 Sep 2006 00:57:34 +0000 (GMT) Received: from dcsmail (dcsmail.anu.edu.au [150.203.164.16]) by anumail8.anu.edu.au (8.13.6.20060614/8.13.6) with ESMTP id k8B0vP9R015247 for ; Mon, 11 Sep 2006 10:57:29 +1000 (EST) (envelope-from bob@cs.anu.edu.au) Received: from littleblue.anu.edu.au ([150.203.160.52] ident=bob) by dcsmail with esmtp (Exim 4.50) id 1GMa72-0007QK-Tt for pgsql-sql@postgresql.org; Mon, 11 Sep 2006 10:57:25 +1000 Message-ID: <4504B474.9010801@cs.anu.edu.au> Date: Mon, 11 Sep 2006 10:57:24 +1000 From: Robert Edwards User-Agent: Debian Thunderbird 1.0.2 (X11/20051002) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 150.203.160.52 X-SA-Exim-Mail-From: bob@cs.anu.edu.au Subject: on connect/on disconnect X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100) X-SA-Exim-Scanned: Yes (on dcsmail) X-PMX-Version: 5.2.0.264296, Antispam-Engine: 2.4.0.264935, Antispam-Data: 2006.9.10.173443 internal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200609/56 X-Sequence-Number: 26267 (this is my first post to this list...) I am wondering if Postgres, and/or SQL in general, has a facility to run a function at connection set-up time (after a successful connection attempt) and/or at session completion (or disconnect)? I want to pre-populate a table (actually an INSERT rule on a view) with some user-specific data that is unlikely to change during the session and which is "difficult" to process (ie. affects performance to do it too often). Clearly, I can do this manually anyway as the first operation after a connection is established, but I would like also to clear it out when the session terminates (so, I guess I am really interested in a "trigger" of some sort on end-of-session). Purely session/connection-based temporary tables would also do what I need, but temporary tables don't seem to be able to work that way. Cheers, Bob Edwards.