Re: [SQL] NULL becomes default

2006-08-21 Thread Andrew Sullivan
On Sun, Aug 20, 2006 at 11:34:48AM +0100, Julian Scarfe wrote:
> So thinking about this a little more, it requires me to be able to change a 
> column value to DEFAULT (unless I implement the default from scratch in the 
> trigger, but that feels messy).  I don't have much experience of triggers: 
> can I do that?

DEFAULT won't work for this case, I don't think; you want to set it
to the nextval() of the sequence or whatever it was you were trying
to do.  But it's not messy: this is precisely the sort of thing
BEFORE triggers are good at.

A

-- 
Andrew Sullivan  | [EMAIL PROTECTED]
"The year's penultimate month" is not in truth a good way of saying
November.
--H.W. Fowler

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


[SQL] Triggers

2006-08-21 Thread Ezequias Rodrigues da Rocha
Hi list,
 
I am planning to generate a trigger to each [update or delete or insert] on my database to register all moviment on my base (current_user, when, action, user).
 
I notice that the trigger is able put a procedure in action but as I have more than 20 tables I would like to use only one trigger to solve my problem. Is that possible ?
 
Now my trigger is working well but I do not want to make 26 triggers and 26 functions.
 
Is there any people that can help me with this question ?=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  Atenciosamente (Sincerely)
Ezequias Rodrigues da Rocha=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-A pior das democracias ainda é melhor do que a melhor das ditadurasThe worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/ 


Re: [SQL] Triggers

2006-08-21 Thread Kaloyan Iliev

Hi,
You can use one procedure(function in Postgres) but you have to use 26 
triggers.
Every trigger can call this one procedure to record the information you 
want.


Regards,
  Kaloyan Iliev

Ezequias Rodrigues da Rocha wrote:


Hi list,
 
I am planning to generate a trigger to each [update or delete or 
insert] on my database to register all moviment on my base 
(current_user, when, action, user).
 
I notice that the trigger is able put a procedure in action but as I 
have more than 20 tables I would like to use only one trigger to solve 
my problem. Is that possible ?
 
Now my trigger is working well but I do not want to make 26 triggers 
and 26 functions.
 
Is there any people that can help me with this question ?



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  Atenciosamente (Sincerely)
Ezequias Rodrigues da Rocha
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
A pior das democracias ainda й melhor do que a melhor das ditaduras
The worst of democracies is still better than the better of dictatorships
http://ezequiasrocha.blogspot.com/




---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org