Passing variables to PostgreSQL database

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
ccampbell
Posts: 31
Joined: Tue 01 Jun 2010 17:31
Location: Oregon

Passing variables to PostgreSQL database

Post by ccampbell » Fri 21 Jan 2011 18:21

Using
VB.net 2010
The latest devart.data.PostgreSQL version
PostgreSQL 9.0.2

Hi, I will ask the question and then explain what I’m doing.

Question: Is there a way to pass a variable from an application user interface to the database such that it would be visible to a database trigger and any corresponding function call?

When a record gets deleted, I have a database trigger that fires and 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 include this variable in the log record that gets created. 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 read it and pass it along?

I’m thinking it’s not possible but thought I would ask anyway.

Thanks,

Chris Campbell

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 24 Jan 2011 15:43

As a possible solution, you can set the application_name configuration parameter on your connection object and then read its value from the pg_stat_activity view:
http://www.devart.com/forums/viewtopic.php?t=19313,
http://www.postgresql.org/docs/9.0/inte ... gging.html.

Post Reply