Re: Default on update

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Default on update
Дата
Msg-id 438477C3.6080208@archonet.com
обсуждение исходный текст
Ответ на Re: Default on update  (lucas@presserv.org)
Список 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 по дате отправления:

Предыдущее
От: Fernando Garcia
Дата:
Сообщение: OUT OF THIS LIST......
Следующее
От: "Eugene E."
Дата:
Сообщение: what is going on in the PostgreSQL