Replying to my own post as I think things through.

----- Original Message ----- 
From: "Richard Huxton" <[EMAIL PROTECTED]>


> Maybe what we need is some sort of module system for these things so you
> could do something like:
> 
> USE MODULE auto_timestamp ON foo (last_modified)
> 
> which could apply the rules/triggers to the relevant table/column. Two
> big pluses I can think of:
> 
> 1. It lets lots of non-developers contribute (e.g. me) without hacking C.
> 2. You are using standard language features so you can learn from
> modules or cut and paste if you loathe them.
> 
> I don't know how complex module support would be, but CPAN doesn't seem
> to have done perl any harm.
> 
> - Richard Huxton

Actually - we've pretty much got this in 7.1 anyway. 
Plpgsql gives us EXECUTE <text> so we can generate triggers etc on the fly.
\i lets us parse a file

So - you could:

-- import functions from module
\i auto_timestamp.pgmod
-- add the triggers
auto_timestamp_addto(mytable,mycolumn)
-- remove the functions provided by the module
auto_timestamp_remove_module()

Does this make sense, or am I talking rubbish here?

- Richard Huxton

Reply via email to