Modification times in records? 
Author Message
 Modification times in records?

        I'm looking for a generalized way to set a field to 'now'
whenever a record is updated.

First, I started creating a plpgsql function for each table that
I needed this for, and then using a trigger.

Later, I realized that the functions were all identical, so I
created one function, which lukily was always updating a field
with the same name.

I'm looking for a way to specify a field name when I create the
trigger, so I can have one function and assign it to any table
with any timestamp field and have it update automagically.
I can't seem to get a parameter into the function.  Any ideas?

--
Adam Haberlach           |A cat spends her life conflicted between a

http://www.***.com/ {*filter*}.com|an equally deep, passionate, and profound
'88 EX500                |desire to avoid getting wet.



Mon, 26 May 2003 16:36:03 GMT
 Modification times in records?


Quote:
>  I'm looking for a generalized way to set a field to 'now'
> whenever a record is updated.

> First, I started creating a plpgsql function for each table that
> I needed this for, and then using a trigger.

> Later, I realized that the functions were all identical, so I
> created one function, which lukily was always updating a field
> with the same name.

> I'm looking for a way to specify a field name when I create the
> trigger, so I can have one function and assign it to any table
> with any timestamp field and have it update automagically.
> I can't seem to get a parameter into the function.  Any ideas?

There's stuff in contrib/spi that handles this (IIRC, a C function
called moddatetime or something like that.) It allows you to specify
a fieldname of the datetime field,  I believe.

Plus, this should be (slightly?) faster that a PLSQL routine.

--

Support Center of Washington (www.scw.org)



Tue, 27 May 2003 06:55:46 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Last modified by and modification time for records in a view

2. follow the modification of the modification in a table

3. Modification Time

4. Help - DTS Check File Modification Times

5. time of last table (object) modification

6. Row Modification Time

7. Find Time/Date of Last Table Modification?

8. Last Modification Date/Time?

9. knowing last modification / last access times of tables..

10. Modification time stamp

11. finding the last modification time/date for JEt using ADO

12. IDS 7.31 versus date/time modification


 
Powered by phpBB® Forum Software