From: Richard Huxton <dev@archonet.com>
To: lucas@presserv.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Default on update
Date: Wed, 23 Nov 2005 14:08:03 +0000
Message-ID: <438477C3.6080208@archonet.com> (raw)
In-Reply-To: <20051123105626.fon1t82f0ctcgogw@www.presserv.org>
References: <20051123084353.8ga6nrpx43gg8408@www.presserv.org>
<43845F23.60204@archonet.com>
<20051123104134.3be3vpyxlc00kko4@www.presserv.org>
<20051123105626.fon1t82f0ctcgogw@www.presserv.org>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, lucas@presserv.org
Subject: Re: Default on update
In-Reply-To: <438477C3.6080208@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox