logo       

Question about accessing current row data inside trigger: msg#00025

Subject: Question about accessing current row data inside trigger
*previously posted this to pgsql-general*

-Hello,
-
-I have a trigger function written in C.
-The trigger function is called via:
-
-CREATE TRIGGER after_update AFTER UPDATE ON some_table
-   FOR EACH ROW EXECUTE PROCEDURE  my_trigger_function();
-
-   Since the trigger is called after each row update the actual
-row data
-should be available in some way to the trigger.
-
-       What functionality (SPI ?) do I use to use the column values -from the
-current row in the actual trigger?
-
-       Does SPI_cursor_fetch automatically give me the current trigger -row or
-do I need to query again for the proper row?
-
-thanks for any insight,
-
-Peter


I am now using :


TupleTableSlot  *t = (TupleTableSlot *) PG_GETARG_POINTER(0);
bool isnull;

char *buffer=(char *)DatumGetPointer(GetAttributeByName(t, "some_column_name", &isnull));



The pointer always comes back NULL though there is data
in the column.

I'm still not sure this is the correct way to access
the data from the updated row.

Is this the correct way to get a string back from
the data in the column named 'some_column_name'?

Do I have the correct TupleTableSlot pointer?

Thanks for any insight,

Peter


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe