Skip site navigation (1) Skip section navigation (2)

How can I tell, in a trigger, if a value in a string is an integer.

From: "Philip W(dot) Dalrymple" <pwd(at)mdtsoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How can I tell, in a trigger, if a value in a string is an integer.
Date: 2008-10-29 14:26:27
Message-ID: 20100913.82041225290387065.JavaMail.root@is-mail-2.mdtsoft.com (view raw or flat)
Thread:
Lists: pgsql-general
I have a trigger function that, for every Update or Insert of
a table inserts a row in a "audit" table that contains some trace
data, the key of the first table and the changed columns (unchanged
cols are NULL) I have this working with a plpgsql function execpt
for one of the trace fields (called the audit_session) which is an 
integer. The value of this should be -1 unless a variable is set
for the session using 

 set_config('session.sessionid','23',false);

which can be read with 

current_setting('session.sessionid')

Which will allow the web server to link a action to a "session"
(data stored in another table but starts from 1 and goes up as 
a integer)

I was not able to make the trigger function work in plperl (where
the forcing of the invalid, unset, or unknown to -1 would be easy).

any ideas on the best way to handle this.

-- 
This email, and any files transmitted with it, is confidential 
and intended solely for the use of the individual or entity to 
whom they are addressed.  If you have received this email in error, 
please advise postmaster(at)mdtsoft(dot)com <mailto:postmaster(at)mdtsoft(dot)com>.

New MDT Software Headquarters (As of July 1, 2008):
3480 Preston Ridge Road
Suite 450
Alpharetta, GA 30005


Philip W. Dalrymple III <pwd(at)mdtsoft(dot)com>
MDT Software - The Change Management Company
+1 678 297 1001
Fax +1 678 297 1003


Responses

pgsql-general by date

Next:From: Tom LaneDate: 2008-10-29 14:38:52
Subject: Re: [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300
Previous:From: Brent AustinDate: 2008-10-29 14:11:32
Subject: Re: [Help] Config Failure on Mac OSX: psqlodbc-08.03.0300

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group