Re: Passing a variable from the user interface to PostgreSQL

From: Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>
To: Chris Campbell <ccampbell(at)cascadeds(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Passing a variable from the user interface to PostgreSQL
Date: 2011-01-22 05:38:47
Message-ID: 4D3A6D67.6050203@vmsinfo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Chris Campbell wrote:
>
> Using:
>
> Windows 7 64bit
>
> VB.net 2010
>
> The latest devart.data.PostgreSQL (.net data connection)
>
> PostgreSQL 9.0.2
>
>
>
> Hi all,
>
>
>
> Question: Is there a way to pass a variable from an application’s user
> interface to the database such that it would be visible inside a
> database trigger and any corresponding function call?
>
>
>
> When a record gets deleted, a table trigger fires that writes to a log
> table. What I want to do is pass a variable from the user interface
> to the trigger function so I can write the variable’s value to the log
> record that I create in a function called from the trigger event. I’m
> not sure how this could even be accomplished unless somehow it was
> possible to pass a variable through the data connection itself. But
> even then, how would the trigger function be able to see it and pass
> it along? Is there some other mechanism or approach I should be taking?
>
>
>
> I’m thinking it’s not possible but thought I would ask anyway.
>
>
>
> Thanks for any comments,
>
>
>
> Chris Campbell
>
> ccampbell(at)CascadeDS(dot)com <mailto:ccampbell(at)CascadeDS(dot)com>
>
>
>
Well, obviously, it isn't possible to pass a variable from UI to a
trigger. What is possible is to send the record primary key, along with
any messages you need, to a background process, using some kind of a
message passing mechanism, and there are plenty of those. The background
process can delete the row and write message in a single transaction. It
can even converse with the UI using message passing system. An excellent
example of such a system, priced exactly right, is Apache ActiveMQ.
Apache ActiveMQ price is exactly half of the Postgres price.

--
Mladen Gogala
Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
www.vmsinfo.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jasen Betts 2011-01-22 08:01:24 Re: Passing a variable from the user interface to PostgreSQL
Previous Message BASIL BOURQUE 2011-01-21 22:10:33 Re: How to detect if in transaction?