Unix Technical Forum

Using PL/pgSQL to Properly Define A Trigger

This is a discussion on Using PL/pgSQL to Properly Define A Trigger within the pgsql Novice forums, part of the PostgreSQL category; --> I am using PostgreSQL version 8.0. The manual (pages 589 - 590), which describes this process, I think needs ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 09:30 PM
Van Ingen, Lane
 
Posts: n/a
Default Using PL/pgSQL to Properly Define A Trigger

I am using PostgreSQL version 8.0. The manual (pages 589 - 590), which describes this process,
I think needs to clarified with an example.

Based on the trigger example (given on p. 590), I am assuming that the trigger variables (given on
p. 589) would be filled in by trigger as follows; can anyone confirm?

NEW: contains the row the trigger is asking the emp_stamp() to act on
OLD: not applicable to example 35-1 on p. 590
TG_NAME: emp_stamp
TG_WHEN: BEFORE
TG_LEVEL: ROW
TG_OP: INSERT or UPDATE -- this may be incorrect !
TG_RELID: -- not sure what this is; does trigger get OID from a system
table for name in TG_RELNAME ?
TG_RELNAME: emp
TG_NARGS: 0 -- not sure how to count 'arguments', am guessing it is '0',
because procedure was called as empstamp() [no args]
TG_ARGV[] : -- no arguments (TG_NARGS) appear to be passed in this example, so I
assume this value would be null. If two arguments were passed, how would they appear
to the function? Single quoted, and comma separated - e.g. 'xxxxxxx','xxxxxxxx' ?


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:10 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com