From: Daniele Orlandi <daniele@orlandi.com>
To: pgsql-sql@postgreSQL.org
Subject: PL/TCL and NULL values
Date: Sun, 18 Apr 1999 03:37:53 +0200
Message-ID: <37193771.230EA8FA@orlandi.com> (raw)
Hi,
I created this trigger to implement templates for a fields in a table.
This works except if fieldvalue in template is NULL. In that case, the field is
excluded in the array and the "set" directive fails.
How can I copy NULL values from TPL to NEW array ?
I think I should test if the value is the array and avoid to execute the set
directive if not, but I'm totally a newbie with TCL. Please help ! :^)
CREATE FUNCTION users_trig_func() RETURNS opaque AS '
spi_exec -array TPL "SELECT * FROM $1 WHERE template= \'$NEW(template)\' AND
force=\'f\'" {
set NEW($TPL(fieldname)) $TPL(fieldvalue)
}
return [array get NEW]
' LANGUAGE 'pltcl';
Thanks in advance.
Bye!
--
Daniele
-------------------------------------------------------------------------------
"Besides, I think [Slackware] sounds better than 'Microsoft,' don't you?"
(By Patrick Volkerding)
-------------------------------------------------------------------------------
Dal 01-03-1993, con un solo POP abbiamo fatto guadagnare a telecom italia
27.325.828 Lire solo in scatti alla risposta. Non male eh ?
-------------------------------------------------------------------------------
Daniele Orlandi - Utility Line Italia - http://www.orlandi.com
Via Mezzera 29/A - 20030 - Seveso (MI) - Italy
-------------------------------------------------------------------------------
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: daniele@orlandi.com
Subject: Re: PL/TCL and NULL values
In-Reply-To: <37193771.230EA8FA@orlandi.com>
References: <37193771.230EA8FA@orlandi.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