Re: Default on update - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Default on update
Date
Msg-id 438477C3.6080208@archonet.com
Whole thread Raw
In response to Re: Default on update  (lucas@presserv.org)
List pgsql-sql
lucas@presserv.org wrote:
>>> I would want to replace "bv" values with FALSE when insert/update 
>>> NULL value for
>>> this field.
>>
>> You could do this by having the application insert to a view with a 
>> rule that replaces null bv values before redirecting to the base table.
> 
> Is more functional to create a Rule instead of a trigger?

It's different - you can think of a rule as a kind of macro, rewriting 
the query the application provides. Make sure you read the manuals 
carefully to be sure you understand how they work though.

>>> Or need I create a TRIGGER that check it and replace the itens???
>>> CREATE or REPLACE function TG_table1_check RETURNS trigger as '
>>>  BEGIN
>>>   IF nullvalue(NEW.bv) THEN
>>
>>
>> IF NEW.bv IS NULL THEN
>>
> What is the difference between nullvalue() and IS NULL???

"IS NULL" is a standard SQL expression.

--   Richard Huxton  Archonet Ltd


pgsql-sql by date:

Previous
From: Fernando Garcia
Date:
Subject: OUT OF THIS LIST......
Next
From: "Eugene E."
Date:
Subject: what is going on in the PostgreSQL