473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

on connect trigger?

Is there any kind of mechanism in pg 7.3 for doing something like what I
would describe as a "login trigger" procedure or maybe "on connect"
trigger, i.e., a way to specify a stored procedure to run when a user
connects to the database?

What I'm thinking is this. Right now, my end-user GUI application calls a
procedure which updates the user account expiration date whenever they
log in. The idea is that accounts that are never used will expire,
eventually, and those that are active will continually have the
expiration date pushed
further ahead each time they log in.

I'd like to not depend on the application making this call, because other
applications which connect to the same database will be written, and the
developers might not build in this same explicit procedure call -- it
really is the kind of thing that is best done on the backend.

~Berend Tober

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
2 3342
Quoting bt****@seaworthysys.com:
Is there any kind of mechanism in pg 7.3 for doing something like what I
would describe as a "login trigger" procedure or maybe "on connect"
trigger, i.e., a way to specify a stored procedure to run when a user
connects to the database?

What I'm thinking is this. Right now, my end-user GUI application calls a
procedure which updates the user account expiration date whenever they
log in. The idea is that accounts that are never used will expire,
eventually, and those that are active will continually have the
expiration date pushed
further ahead each time they log in.

I'd like to not depend on the application making this call, because other
applications which connect to the same database will be written, and the
developers might not build in this same explicit procedure call -- it
really is the kind of thing that is best done on the backend.

~Berend Tober

Berend,

I've got something like that setup on an e-communities site I built. There was
already a "last action" query/report I had so what I have setup on as part of
the database nightly vacuum is to first delete any account that did not have any
actions for over a year. You don't need to do a trigger to do that. You just
need to make a cron job that run at whatever is an acceptable interval.

--
Keith C. Perry, MS E.E.
Director of Networks & Applications
VCSN, Inc.
http://vcsn.com

____________________________________
This email account is being host by:
VCSN, Inc : http://vcsn.com

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #2
Quoting bt****@seaworthysys.com:
Is there any kind of mechanism in pg 7.3 for doing something like
what I would describe as a "login trigger" procedure to run
when a user connects to the database?


Berend,

I've got something like that setup on an e-communities site I built.
There was already a "last action" query/report I had so what I have
setup on as part of the database nightly vacuum is to first delete any
account that did not have any actions for over a year. You don't need
to do a trigger to do that. You just need to make a cron job that run
at whatever is an acceptable interval.

--
Keith C. Perry, MS E.E.


That sounds somewhat interesting, and I understand the crontab approach,
but the key to your methods is that "last action" thing. I can see how I
might get a date from some table that has an column value that gets
assigned the current date after insert or update (using DEFAULT or a
trigger), but what if the user's access is read-only, i.e., they perform
only SELECT operations? How could I catch that?

~Berend Tober


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Scott CM | last post by:
I have a multi-part question regarding trigger performance. First of all, is there performance gain from issuing the following within a trigger: SELECT PrimaryKeyColumn FROM INSERTED opposed...
0
by: btober | last post by:
Is there any kind of mechanism in pg 7.3 for doing something like what I would describe as a "login trigger" procedure or maybe "on connect" trigger, i.e., a way to specify a stored procedure to...
0
by: JohnO | last post by:
Thanks to Serge and MarkB for recent tips and suggestions. Ive rolled together a few stored procedures to assist with creating audit triggers automagically. Hope someone finds this as useful as...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
9
by: Ots | last post by:
I'm using SQL 2000, which is integrated with a VB.NET 2003 app. I have an Audit trigger that logs changes to tables. I want to apply this trigger to many different tables. It's the same trigger,...
7
by: jeevalokesh | last post by:
hi i need answer for one question what is connect by priority? which trigger can be used for this ?
11
by: tracy | last post by:
Hi, I really need help. I run this script and error message appeal as below: drop trigger log_errors_trig; drop trigger log_errors_trig ERROR at line 1: ORA04080: trigger 'LOG_ERRORS-TRIG'...
6
by: SRK | last post by:
Hi, I have installed free TDS ODBC driver on Linux and from there I am trying to connect to MS SQLSERVER installed on Windows machine. But it gives me following error - tsql -H ps6312 -p 1433...
3
seraieis
by: seraieis | last post by:
I'm running SQL Server 2005 (fairly new to this application) and I'm looking to use this to connect a DB2 server, and also a MDB file (if possible). My goal is to run queries out of DB2 that uses...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.