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 DF2F69FB278 for ; Mon, 11 Sep 2006 01:28:52 -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 99995-07 for ; Mon, 11 Sep 2006 04:28:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by postgresql.org (Postfix) with ESMTP id 072879FB1C8 for ; Mon, 11 Sep 2006 01:28:44 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so1984754pyd for ; Sun, 10 Sep 2006 21:28:44 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=ZSbYp+endq4PuXD+iABzbVGykU/e+1YgN3W/+aC7ath20TOq1pZWlw/hmjSFJkcXv3h1ECKMIjYt1RZlGAS/vgKFgO4DxUkYUSQI4xj+s/MBf7u2ccY0GI8DyWYzShn7OespNT7SjSDIuN/pURKsezT/TPemnbmoJCESe0cdtcU= Received: by 10.35.76.10 with SMTP id d10mr8053633pyl; Sun, 10 Sep 2006 21:28:43 -0700 (PDT) Received: by 10.35.80.9 with HTTP; Sun, 10 Sep 2006 21:28:43 -0700 (PDT) Message-ID: Date: Sun, 10 Sep 2006 23:28:43 -0500 From: "Aaron Bono" To: "Robert Edwards" Subject: Re: on connect/on disconnect Cc: pgsql-sql@postgresql.org In-Reply-To: <4504B474.9010801@cs.anu.edu.au> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_66221_14809927.1157948923825" References: <4504B474.9010801@cs.anu.edu.au> X-Google-Sender-Auth: 93c06c5abbacd628 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.2 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/57 X-Sequence-Number: 26268 ------=_Part_66221_14809927.1157948923825 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/10/06, Robert Edwards wrote: > > (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. What kind of operation are you wanting to do? Would it work if an application like a web site used connection pooling - thus sharing the session across application users and rarely if ever connecting/disconnecting? ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------=_Part_66221_14809927.1157948923825 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/10/06, Robert Edwards <bob@cs.anu.edu.au> wrote:
(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.

 
What kind of operation are you wanting to do?  Would it work if an application like a web site used connection pooling - thus sharing the session across application users and rarely if ever connecting/disconnecting?

==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
================================================================== ------=_Part_66221_14809927.1157948923825--